Fix Parameters

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-03-13 22:20:40 +11:00
parent 3b9c41fb6c
commit ca303152e6
3 changed files with 27 additions and 12 deletions

View File

@ -105,9 +105,12 @@ def stack_create(options, arguments):
return FAILURE return FAILURE
if options.parameters: if options.parameters:
count=1
for p in options.parameters.split(';'): for p in options.parameters.split(';'):
(n, v) = p.split('=') (n, v) = p.split('=')
parameters[n] = v parameters['Parameters.member.%d.ParameterKey' % count] = n
parameters['Parameters.member.%d.ParameterValue' % count] = v
count = count + 1
if options.template_file: if options.template_file:
parameters['TemplateBody'] = open(options.template_file).read() parameters['TemplateBody'] = open(options.template_file).read()
@ -133,6 +136,19 @@ def stack_update(options, arguments):
print "as the first argument" print "as the first argument"
return FAILURE return FAILURE
if options.template_file:
parameters['TemplateBody'] = open(options.template_file).read()
elif options.template_url:
parameters['TemplateUrl'] = options.template_url
if options.parameters:
count=1
for p in options.parameters.split(';'):
(n, v) = p.split('=')
parameters['Parameters.member.%d.ParameterKey' % count] = n
parameters['Parameters.member.%d.ParameterValue' % count] = v
count = count + 1
c = get_client(options) c = get_client(options)
result = c.update_stack(parameters) result = c.update_stack(parameters)
print json.dumps(result, indent=2) print json.dumps(result, indent=2)

View File

@ -69,7 +69,7 @@ class StackController(object):
} }
]}]}]} ]}]}]}
def describe(self, req): def describe(self, req):
return {'stack': [ return {'stack': [
@ -77,7 +77,7 @@ class StackController(object):
'name': '<stack NAME', 'name': '<stack NAME',
'disk_format': '<DISK_FORMAT>', 'disk_format': '<DISK_FORMAT>',
'container_format': '<CONTAINER_FORMAT>' } ] } 'container_format': '<CONTAINER_FORMAT>' } ] }
def create(self, req): def create(self, req):
for p in req.params: for p in req.params:
@ -110,7 +110,7 @@ class StackController(object):
:raises HttpNotAuthorized if image or any chunk is not :raises HttpNotAuthorized if image or any chunk is not
deleteable by the requesting user deleteable by the requesting user
""" """
class StackDeserializer(wsgi.JSONRequestDeserializer): class StackDeserializer(wsgi.JSONRequestDeserializer):
"""Handles deserialization of specific controller method requests.""" """Handles deserialization of specific controller method requests."""

View File

@ -581,13 +581,12 @@ class BaseClient(object):
reduced to reduced to
:retval subset of 'params' dict :retval subset of 'params' dict
""" """
#result = {} result = {}
#for allowed_param in allowed_params: for param in actual_params:
# if allowed_param in actual_params: if param in allowed_params:
# result[allowed_param] = actual_params[allowed_param] result[param] = actual_params[param]
elif 'Parameters.member.' in param:
result[param] = actual_params[param]
#return result return result
# allow user parameters
return actual_params