From c4266d89df76fb4f577d33d3bd36e4838cbbcc21 Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Sun, 20 Apr 2014 23:06:49 +0400 Subject: [PATCH] Rename Type to Usage for MuranoPL properties Change-Id: Ide9368fd57d3322476d59c7d4cbb83d59736f664 Closes-Bug: #1308924 --- meta/io.murano/Classes/Environment.yaml | 6 +++--- meta/io.murano/Classes/resources/Instance.yaml | 2 +- muranoapi/dsl/murano_object.py | 4 ++-- muranoapi/dsl/typespec.py | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/meta/io.murano/Classes/Environment.yaml b/meta/io.murano/Classes/Environment.yaml index b9a5f3ab..fc013eaf 100644 --- a/meta/io.murano/Classes/Environment.yaml +++ b/meta/io.murano/Classes/Environment.yaml @@ -13,15 +13,15 @@ Properties: agentListener: Contract: $.class(sys:AgentListener) - Type: Runtime + Usage: Runtime stack: Contract: $.class(sys:HeatStack) - Type: Runtime + Usage: Runtime instanceNotifier: Contract: $.class(sys:InstanceNotifier) - Type: Runtime + Usage: Runtime Workflow: initialize: diff --git a/meta/io.murano/Classes/resources/Instance.yaml b/meta/io.murano/Classes/resources/Instance.yaml index 6ccfd822..e0a973ae 100644 --- a/meta/io.murano/Classes/resources/Instance.yaml +++ b/meta/io.murano/Classes/resources/Instance.yaml @@ -17,7 +17,7 @@ Properties: agent: Contract: $.class(sys:Agent) - Type: Runtime + Usage: Runtime Workflow: diff --git a/muranoapi/dsl/murano_object.py b/muranoapi/dsl/murano_object.py index 133e5ee1..a185e51a 100644 --- a/muranoapi/dsl/murano_object.py +++ b/muranoapi/dsl/murano_object.py @@ -130,7 +130,7 @@ class MuranoObject(object): if key in self.__type.properties: spec = self.__type.get_property(key) if caller_class is not None \ - and (spec.type not in typespec.PropertyTypes.Writable + and (spec.usage not in typespec.PropertyUsages.Writable or not caller_class.is_compatible(self)): raise exceptions.NoWriteAccess(key) @@ -174,7 +174,7 @@ class MuranoObject(object): for property_name in self.type.properties: if property_name in self.__properties: spec = self.type.get_property(property_name) - if spec.type != typespec.PropertyTypes.Runtime: + if spec.usage != typespec.PropertyUsages.Runtime: result[property_name] = \ self.__properties[property_name] return result diff --git a/muranoapi/dsl/typespec.py b/muranoapi/dsl/typespec.py index 7d7f6dca..5bdef17f 100644 --- a/muranoapi/dsl/typespec.py +++ b/muranoapi/dsl/typespec.py @@ -15,7 +15,7 @@ import muranoapi.dsl.type_scheme as type_scheme -class PropertyTypes(object): +class PropertyUsages(object): In = 'In' Out = 'Out' InOut = 'InOut' @@ -31,10 +31,10 @@ class Spec(object): self._contract = type_scheme.TypeScheme(declaration['Contract']) self._default = declaration.get('Default') self._has_default = 'Default' in declaration - self._type = declaration.get('Type') or 'In' - if self._type not in PropertyTypes.All: + self._usage = declaration.get('Usage') or 'In' + if self._usage not in PropertyUsages.All: raise SyntaxError('Unknown type {0}. Must be one of ({1})'.format( - self._type, ', '.join(PropertyTypes.All))) + self._usage, ', '.join(PropertyUsages.All))) def validate(self, value, this, context, object_store, default=None): if default is None: @@ -51,8 +51,8 @@ class Spec(object): return self._has_default @property - def type(self): - return self._type + def usage(self): + return self._usage class PropertySpec(Spec):