]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Pass the keystone creds to resource.py so usable from run-parser and heat
authorAngus Salkeld <asalkeld@redhat.com>
Mon, 2 Apr 2012 02:00:21 +0000 (12:00 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Mon, 2 Apr 2012 02:00:21 +0000 (12:00 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
bin/run-parser.py
heat/engine/parser.py
heat/engine/resources.py

index 8af8cca73814a7ef00661a9a4351c44b76ad7536..594271c9dcff5abf61a726bf1547bcc1150913af 100755 (executable)
@@ -49,5 +49,17 @@ with open(filename) as f:
     setparam(params_dict, 'DBRootPassword', 'admone')
     setparam(params_dict, 'LinuxDistribution', 'F16')
 
+    # set the keystone auth environs up
+    username = os.environ['OS_USERNAME']
+    password = os.environ['OS_PASSWORD']
+    tenant = os.environ['OS_TENANT_NAME']
+    auth_url = os.environ['OS_AUTH_URL']
+
+    params_dict['KeyStoneCreds'] = dict(username=username,
+                                        password=password,
+                                        tenant=tenant,
+                                        auth_url=auth_url,
+                                        strategy='keystone')
+
     stack = parser.Stack(stack_name, json_blob, params_dict)
     stack.start()
index 1d679c3ee73b831936319031590081374e235451..7389ca186534779c7d0f3ac3933975e08c20a7b6 100644 (file)
@@ -42,6 +42,7 @@ class Stack:
 
         if parms != None:
             self._apply_user_parameters(parms)
+        self.creds = parms['KeyStoneCreds']
 
         self.resources = {}
         for r in self.t['Resources']:
index 4ddc5980cf6c10f486b90840d0900c252d2628e4..10ed0883d68ce412eda0f6df1b9592f1669308cf 100644 (file)
@@ -289,16 +289,11 @@ class Instance(Resource):
         distro_name = self.stack.parameter_get('LinuxDistribution')
         key_name = self.t['Properties']['KeyName']
         image_name = self.t['Properties']['ImageId']
-       
-        # TODO(sdake)
-        #  self.stack.parameter_get('KeyStoneCreds')
-        #  parse the keystone credentials and set the os variables
-        #  note this works with bin/run-parser.py ;)
-        username = os.environ['OS_USERNAME']
-        password = os.environ['OS_PASSWORD']
-        tenant = os.environ['OS_TENANT_NAME']
-        auth_url = os.environ['OS_AUTH_URL']
 
+        username = self.stack.creds['username']
+        password = self.stack.creds['password']
+        tenant = self.stack.creds['tenant']
+        auth_url = self.stack.creds['auth_url']
 
         nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova')
         image_list = nova_client.images.list()