Merge "Rename Type to Usage for MuranoPL properties"
This commit is contained in:
commit
3e05fa6e66
@ -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:
|
||||
|
@ -17,7 +17,7 @@ Properties:
|
||||
|
||||
agent:
|
||||
Contract: $.class(sys:Agent)
|
||||
Type: Runtime
|
||||
Usage: Runtime
|
||||
|
||||
|
||||
Workflow:
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user