Skip to content
Browse files

Pass the keystone creds to resource.py so usable from run-parser and …

…heat

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
  • Loading branch information...
1 parent 7d11d4a commit 8d372fcb16b2da3346446dc16a3b9bd8fcc7f1be @asalkeld asalkeld committed
Showing with 17 additions and 9 deletions.
  1. +12 −0 bin/run-parser.py
  2. +1 −0 heat/engine/parser.py
  3. +4 −9 heat/engine/resources.py
View
12 bin/run-parser.py
@@ -49,5 +49,17 @@ def setparam(t, key, value):
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()
View
1 heat/engine/parser.py
@@ -42,6 +42,7 @@ def __init__(self, stack_name, template, parms=None):
if parms != None:
self._apply_user_parameters(parms)
+ self.creds = parms['KeyStoneCreds']
self.resources = {}
for r in self.t['Resources']:
View
13 heat/engine/resources.py
@@ -289,16 +289,11 @@ def _null_callback(p, n, out):
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()

0 comments on commit 8d372fc

Please sign in to comment.
Something went wrong with that request. Please try again.