Dennis Dmitriev | 3ec2e53 | 2018-06-08 04:33:34 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Source file to set access credentials to salt-api for using with libpepper |
| 4 | # Requires: |
| 5 | # - ENV_NAME |
| 6 | # Example usage: |
| 7 | # $> . ./tcp_tests/utils/env_salt |
| 8 | # $> pepper -C 'I@linux:system' test.ping |
| 9 | |
| 10 | CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) |
| 11 | export PYTHONPATH=${CURRENT_DIR}/../.. |
| 12 | |
Dennis Dmitriev | 06fac23 | 2018-07-19 13:20:53 +0300 | [diff] [blame] | 13 | export SALT_MASTER_INFO=$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01; done) |
| 14 | export SALT_MASTER_HOSTNAME=${SALT_MASTER_HOSTNAME:-$(echo $SALT_MASTER_INFO|cut -d',' -f1)} |
| 15 | export SALT_MASTER_IP=${SALT_MASTER_IP:-$(echo $SALT_MASTER_INFO|cut -d',' -f2)} |
Dennis Dmitriev | 3ec2e53 | 2018-06-08 04:33:34 +0300 | [diff] [blame] | 16 | |
| 17 | if [ -z "$SALT_MASTER_IP" ]; then |
| 18 | echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'" |
| 19 | unset SALT_MASTER_IP |
| 20 | unset SALTAPI_URL |
| 21 | unset SALTAPI_USER |
| 22 | unset SALTAPI_PASS |
| 23 | unset SALTAPI_EAUTH |
| 24 | else |
| 25 | # For pepper client |
| 26 | export SALTAPI_URL=http://${SALT_MASTER_IP}:6969/ |
| 27 | export SALTAPI_USER='salt' |
| 28 | export SALTAPI_PASS='hovno12345!' |
| 29 | export SALTAPI_EAUTH='pam' |
| 30 | fi |
| 31 | |
| 32 | echo "export SALT_MASTER_IP='${SALT_MASTER_IP}'" |
| 33 | echo "export SALTAPI_URL='${SALTAPI_URL}'" |
| 34 | echo "export SALTAPI_USER='${SALTAPI_USER}'" |
| 35 | echo "export SALTAPI_PASS='${SALTAPI_PASS}'" |
| 36 | echo "export SALTAPI_EAUTH='${SALTAPI_EAUTH}'" |