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

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-04-02 12:00:21 +10:00
parent 7d11d4abf6
commit 8d372fcb16
3 changed files with 17 additions and 9 deletions

View File

@ -49,5 +49,17 @@ with open(filename) as f:
setparam(params_dict, 'DBRootPassword', 'admone') setparam(params_dict, 'DBRootPassword', 'admone')
setparam(params_dict, 'LinuxDistribution', 'F16') 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 = parser.Stack(stack_name, json_blob, params_dict)
stack.start() stack.start()

View File

@ -42,6 +42,7 @@ class Stack:
if parms != None: if parms != None:
self._apply_user_parameters(parms) self._apply_user_parameters(parms)
self.creds = parms['KeyStoneCreds']
self.resources = {} self.resources = {}
for r in self.t['Resources']: for r in self.t['Resources']:

View File

@ -290,15 +290,10 @@ class Instance(Resource):
key_name = self.t['Properties']['KeyName'] key_name = self.t['Properties']['KeyName']
image_name = self.t['Properties']['ImageId'] image_name = self.t['Properties']['ImageId']
# TODO(sdake) username = self.stack.creds['username']
# self.stack.parameter_get('KeyStoneCreds') password = self.stack.creds['password']
# parse the keystone credentials and set the os variables tenant = self.stack.creds['tenant']
# note this works with bin/run-parser.py ;) auth_url = self.stack.creds['auth_url']
username = os.environ['OS_USERNAME']
password = os.environ['OS_PASSWORD']
tenant = os.environ['OS_TENANT_NAME']
auth_url = os.environ['OS_AUTH_URL']
nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova') nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova')
image_list = nova_client.images.list() image_list = nova_client.images.list()