STACK_CREATION_TIME: timeutils.isotime(stack.created_time),
STACK_UPDATED_TIME: timeutils.isotime(stack.updated_time),
STACK_NOTIFICATION_TOPICS: [], # TODO Not implemented yet
- STACK_PARAMETERS: dict(stack.parameters),
+ STACK_PARAMETERS: stack.parameters.map(str),
STACK_DESCRIPTION: stack.t[template.DESCRIPTION],
STACK_TMPL_DESCRIPTION: stack.t[template.DESCRIPTION],
STACK_STATUS: stack.state,
'Every Resources object must contain a Type member.'}
def describe_param(p):
- description = {'NoEcho': 'false',
+ description = {'NoEcho': p.no_echo() and 'true' or 'false',
'ParameterKey': p.name,
'Description': p.description()}
if p.has_default():
raise KeyError('Missing parameter %s' % self.name)
+ def no_echo(self):
+ '''
+ Return whether the parameter should be sanitised in any output to
+ the user.
+ '''
+ return self.schema.get(NO_ECHO, 'false').lower() == 'true'
+
def description(self):
'''Return the description of the parameter.'''
return self.schema.get(DESCRIPTION, '')
def __str__(self):
'''Return a string representation of the parameter'''
- return self.value()
+ value = self.value()
+ if self.no_echo():
+ return '******'
+ else:
+ return value
class NumberParam(Parameter):
else:
self.fail('ValueError not raised')
+ def test_no_echo_true(self):
+ p = parameters.Parameter('anechoic',
+ {'Type': 'String',
+ 'NoEcho': 'true'},
+ 'wibble')
+ self.assertTrue(p.no_echo())
+ self.assertNotEqual(str(p), 'wibble')
+
+ def test_no_echo_true_caps(self):
+ p = parameters.Parameter('anechoic',
+ {'Type': 'String',
+ 'NoEcho': 'TrUe'},
+ 'wibble')
+ self.assertTrue(p.no_echo())
+ self.assertNotEqual(str(p), 'wibble')
+
+ def test_no_echo_false(self):
+ p = parameters.Parameter('echoic',
+ {'Type': 'String',
+ 'NoEcho': 'false'},
+ 'wibble')
+ self.assertFalse(p.no_echo())
+ self.assertEqual(str(p), 'wibble')
+
def test_description(self):
description = 'Description of the parameter'
p = parameters.Parameter('p', {'Type': 'String',