Merge "Add HIDDEN status to RandomString sequence"

This commit is contained in:
Jenkins 2015-07-23 10:10:13 +00:00 committed by Gerrit Code Review
commit 4cd5369fc4
2 changed files with 24 additions and 25 deletions

View File

@ -79,9 +79,13 @@ class RandomString(resource.Resource):
'octdigits']),
],
support_status=support.SupportStatus(
status=support.DEPRECATED,
message=_('Use property %s.') % CHARACTER_CLASSES,
version='2014.2'
status=support.HIDDEN,
version='5.0.0',
previous_status=support.SupportStatus(
status=support.DEPRECATED,
message=_('Use property %s.') % CHARACTER_CLASSES,
version='2014.2'
)
)
),
CHARACTER_CLASSES: properties.Schema(
@ -169,6 +173,23 @@ class RandomString(resource.Resource):
'octdigits': string.octdigits
}
def translation_rules(self):
if self.properties.get(self.SEQUENCE):
return [
properties.TranslationRule(
self.properties,
properties.TranslationRule.ADD,
[self.CHARACTER_CLASSES],
[{self.CHARACTER_CLASSES_CLASS: self.properties.get(
self.SEQUENCE),
self.CHARACTER_CLASSES_MIN: 1}]),
properties.TranslationRule(
self.properties,
properties.TranslationRule.DELETE,
[self.SEQUENCE]
)
]
@staticmethod
def _deprecated_random_string(sequence, length):
rand = random.SystemRandom()

View File

@ -154,28 +154,6 @@ Resources:
secret6.resource_id = None
self.assertEqual('secret6', secret6.FnGetRefId())
def test_invalid_property_combination(self):
template_random_string = '''
HeatTemplateFormatVersion: '2012-12-12'
Resources:
secret:
Type: OS::Heat::RandomString
Properties:
length: 32
sequence: octdigits
character_classes:
- class: digits
min: 1
character_sequences:
- sequence: (),[]{}
min: 1
'''
exc = self.assertRaises(exception.StackValidationFailed,
self.create_stack, template_random_string)
self.assertEqual("Cannot use deprecated 'sequence' property along "
"with 'character_sequences' or 'character_classes' "
"properties", six.text_type(exc))
def test_invalid_length(self):
template_random_string = '''
HeatTemplateFormatVersion: '2012-12-12'