From f2b60f308fee3fe41033d2e56ccbc702d226cbeb Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 25 Sep 2018 14:53:02 -0400 Subject: [PATCH] Validate attributes schema We always check that a properties schema is valid at the time that it is created. Do the same for the attributes schema. This will catch programming errors in the writing of Resource plugins. Change-Id: I8119aec30b83f1f9e711013a60a828ae4a8337c7 Story: #2003915 --- heat/engine/attributes.py | 10 +++++----- .../attribute-schema-validation-db615003e577f8dd.yaml | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/attribute-schema-validation-db615003e577f8dd.yaml diff --git a/heat/engine/attributes.py b/heat/engine/attributes.py index 47e50be56a..f5fcdf2655 100644 --- a/heat/engine/attributes.py +++ b/heat/engine/attributes.py @@ -48,19 +48,19 @@ class Schema(constr.Schema): ) TYPES = ( - STRING, MAP, LIST, INTEGER, BOOLEAN + UNKNOWN, STRING, MAP, LIST, INTEGER, BOOLEAN ) = ( - 'String', 'Map', 'List', 'Integer', 'Boolean' + None, 'String', 'Map', 'List', 'Integer', 'Boolean' ) def __init__(self, description=None, support_status=support.SupportStatus(), cache_mode=CACHE_LOCAL, - type=None): - self.description = description + type=UNKNOWN): + super(Schema, self).__init__(type, description) self.support_status = support_status self.cache_mode = cache_mode - self.type = type + self.validate() def __getitem__(self, key): if key == self.DESCRIPTION: diff --git a/releasenotes/notes/attribute-schema-validation-db615003e577f8dd.yaml b/releasenotes/notes/attribute-schema-validation-db615003e577f8dd.yaml new file mode 100644 index 0000000000..904678a64d --- /dev/null +++ b/releasenotes/notes/attribute-schema-validation-db615003e577f8dd.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + When loading a Resource plugin, the attribute schema is now validated in + the same way that the properties schema is. Third-party resource plugins + should be tested to check that they still comply.