blob: 4e21f85e9465eaf30a53cda8ee6ca7bf68da7665 [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
Dennis Dmitriev06fac232018-07-19 13:20:53 +030013export SALT_MASTER_INFO=$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01; done)
14export SALT_MASTER_HOSTNAME=${SALT_MASTER_HOSTNAME:-$(echo $SALT_MASTER_INFO|cut -d',' -f1)}
15export SALT_MASTER_IP=${SALT_MASTER_IP:-$(echo $SALT_MASTER_INFO|cut -d',' -f2)}
Dennis Dmitriev3ec2e532018-06-08 04:33:34 +030016
17if [ -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
24else
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'
30fi
31
32echo "export SALT_MASTER_IP='${SALT_MASTER_IP}'"
33echo "export SALTAPI_URL='${SALTAPI_URL}'"
34echo "export SALTAPI_USER='${SALTAPI_USER}'"
35echo "export SALTAPI_PASS='${SALTAPI_PASS}'"
36echo "export SALTAPI_EAUTH='${SALTAPI_EAUTH}'"