diff --git a/bin/run-parser.py b/bin/run-parser.py index 8af8cca738..594271c9dc 100755 --- a/bin/run-parser.py +++ b/bin/run-parser.py @@ -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() diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 1d679c3ee7..7389ca1865 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -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']: diff --git a/heat/engine/resources.py b/heat/engine/resources.py index 4ddc5980cf..10ed0883d6 100644 --- a/heat/engine/resources.py +++ b/heat/engine/resources.py @@ -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()