blob: 4e21f85e9465eaf30a53cda8ee6ca7bf68da7665 [file] [log] [blame]
#!/bin/bash
# Source file to set access credentials to salt-api for using with libpepper
# Requires:
# - ENV_NAME
# Example usage:
# $> . ./tcp_tests/utils/env_salt
# $> pepper -C 'I@linux:system' test.ping
CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
export PYTHONPATH=${CURRENT_DIR}/../..
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)
export SALT_MASTER_HOSTNAME=${SALT_MASTER_HOSTNAME:-$(echo $SALT_MASTER_INFO|cut -d',' -f1)}
export SALT_MASTER_IP=${SALT_MASTER_IP:-$(echo $SALT_MASTER_INFO|cut -d',' -f2)}
if [ -z "$SALT_MASTER_IP" ]; then
echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'"
unset SALT_MASTER_IP
unset SALTAPI_URL
unset SALTAPI_USER
unset SALTAPI_PASS
unset SALTAPI_EAUTH
else
# For pepper client
export SALTAPI_URL=http://${SALT_MASTER_IP}:6969/
export SALTAPI_USER='salt'
export SALTAPI_PASS='hovno12345!'
export SALTAPI_EAUTH='pam'
fi
echo "export SALT_MASTER_IP='${SALT_MASTER_IP}'"
echo "export SALTAPI_URL='${SALTAPI_URL}'"
echo "export SALTAPI_USER='${SALTAPI_USER}'"
echo "export SALTAPI_PASS='${SALTAPI_PASS}'"
echo "export SALTAPI_EAUTH='${SALTAPI_EAUTH}'"