aboutsummaryrefslogtreecommitdiffstats
path: root/utils/openstack_utils.py
diff options
context:
space:
mode:
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
# *********************************************