diff --git a/heat/engine/resources/openstack/heat/random_string.py b/heat/engine/resources/openstack/heat/random_string.py index f5e6d8ac0..fcdea373d 100644 --- a/heat/engine/resources/openstack/heat/random_string.py +++ b/heat/engine/resources/openstack/heat/random_string.py @@ -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() diff --git a/heat/tests/test_random_string.py b/heat/tests/test_random_string.py index cec5b497e..9e4832c17 100644 --- a/heat/tests/test_random_string.py +++ b/heat/tests/test_random_string.py @@ -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'