blob: 12c4575e3a1457deb4cb1081f26081eb69705698 [file] [log] [blame]
Dennis Dmitriev3ec2e532018-06-08 04:33:34 +03001#!/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
10CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
11export PYTHONPATH=${CURRENT_DIR}/../..
12
13export SALT_MASTER_IP=${SALT_MASTER_IP:-$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01|cut -d',' -f2; done)}
14
15if [ -z "$SALT_MASTER_IP" ]; then
16 echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'"
17 unset SALT_MASTER_IP
18 unset SALTAPI_URL
19 unset SALTAPI_USER
20 unset SALTAPI_PASS
21 unset SALTAPI_EAUTH
22else
23 # For pepper client
24 export SALTAPI_URL=http://${SALT_MASTER_IP}:6969/
25 export SALTAPI_USER='salt'
26 export SALTAPI_PASS='hovno12345!'
27 export SALTAPI_EAUTH='pam'
28fi
29
30echo "export SALT_MASTER_IP='${SALT_MASTER_IP}'"
31echo "export SALTAPI_URL='${SALTAPI_URL}'"
32echo "export SALTAPI_USER='${SALTAPI_USER}'"
33echo "export SALTAPI_PASS='${SALTAPI_PASS}'"
34echo "export SALTAPI_EAUTH='${SALTAPI_EAUTH}'"