summaryrefslogtreecommitdiffstats
path: root/utils/openstack_utils.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-04-25 18:08:22 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-04-27 15:34:56 +0200
commit9c13968cdb32806da738dc520d45270e019f0ad3 (patch)
tree50eb0e0889dc72a1ce4dec0da60607c834d91fc0 /utils/openstack_utils.py
parent790fa04f4503dbf60123bf9414db131580f2c45a (diff)
Create prepare_env.py from prepare_env.sh and config_functest.py
JIRA: FUNCTEST-227 Change-Id: I1aa890b9f91ec524c766ba3c460666ed227f2126 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'utils/openstack_utils.py')
-rw-r--r--utils/openstack_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index ff3968d67..2ae2842d4 100644
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -10,6 +10,7 @@
import os
import os.path
+import subprocess
import sys
# ----------------------------------------------------------
@@ -73,6 +74,15 @@ def get_credentials(service):
return creds
+def source_credentials(rc_file):
+ pipe = subprocess.Popen(". %s; env" % rc_file, stdout=subprocess.PIPE,
+ shell=True)
+ output = pipe.communicate()[0]
+ env = dict((line.split("=", 1) for line in output.splitlines()))
+ os.environ.update(env)
+ return env
+
+
# *********************************************
# NOVA
# *********************************************