Merge "Rename Type to Usage for MuranoPL properties"
This commit is contained in:
commit
3e05fa6e66
@ -13,15 +13,15 @@ Properties:
|
|||||||
|
|
||||||
agentListener:
|
agentListener:
|
||||||
Contract: $.class(sys:AgentListener)
|
Contract: $.class(sys:AgentListener)
|
||||||
Type: Runtime
|
Usage: Runtime
|
||||||
|
|
||||||
stack:
|
stack:
|
||||||
Contract: $.class(sys:HeatStack)
|
Contract: $.class(sys:HeatStack)
|
||||||
Type: Runtime
|
Usage: Runtime
|
||||||
|
|
||||||
instanceNotifier:
|
instanceNotifier:
|
||||||
Contract: $.class(sys:InstanceNotifier)
|
Contract: $.class(sys:InstanceNotifier)
|
||||||
Type: Runtime
|
Usage: Runtime
|
||||||
|
|
||||||
Workflow:
|
Workflow:
|
||||||
initialize:
|
initialize:
|
||||||
|
@ -17,7 +17,7 @@ Properties:
|
|||||||
|
|
||||||
agent:
|
agent:
|
||||||
Contract: $.class(sys:Agent)
|
Contract: $.class(sys:Agent)
|
||||||
Type: Runtime
|
Usage: Runtime
|
||||||
|
|
||||||
|
|
||||||
Workflow:
|
Workflow:
|
||||||
|
@ -130,7 +130,7 @@ class MuranoObject(object):
|
|||||||
if key in self.__type.properties:
|
if key in self.__type.properties:
|
||||||
spec = self.__type.get_property(key)
|
spec = self.__type.get_property(key)
|
||||||
if caller_class is not None \
|
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)):
|
or not caller_class.is_compatible(self)):
|
||||||
raise exceptions.NoWriteAccess(key)
|
raise exceptions.NoWriteAccess(key)
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ class MuranoObject(object):
|
|||||||
for property_name in self.type.properties:
|
for property_name in self.type.properties:
|
||||||
if property_name in self.__properties:
|
if property_name in self.__properties:
|
||||||
spec = self.type.get_property(property_name)
|
spec = self.type.get_property(property_name)
|
||||||
if spec.type != typespec.PropertyTypes.Runtime:
|
if spec.usage != typespec.PropertyUsages.Runtime:
|
||||||
result[property_name] = \
|
result[property_name] = \
|
||||||
self.__properties[property_name]
|
self.__properties[property_name]
|
||||||
return result
|
return result
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import muranoapi.dsl.type_scheme as type_scheme
|
import muranoapi.dsl.type_scheme as type_scheme
|
||||||
|
|
||||||
|
|
||||||
class PropertyTypes(object):
|
class PropertyUsages(object):
|
||||||
In = 'In'
|
In = 'In'
|
||||||
Out = 'Out'
|
Out = 'Out'
|
||||||
InOut = 'InOut'
|
InOut = 'InOut'
|
||||||
@ -31,10 +31,10 @@ class Spec(object):
|
|||||||
self._contract = type_scheme.TypeScheme(declaration['Contract'])
|
self._contract = type_scheme.TypeScheme(declaration['Contract'])
|
||||||
self._default = declaration.get('Default')
|
self._default = declaration.get('Default')
|
||||||
self._has_default = 'Default' in declaration
|
self._has_default = 'Default' in declaration
|
||||||
self._type = declaration.get('Type') or 'In'
|
self._usage = declaration.get('Usage') or 'In'
|
||||||
if self._type not in PropertyTypes.All:
|
if self._usage not in PropertyUsages.All:
|
||||||
raise SyntaxError('Unknown type {0}. Must be one of ({1})'.format(
|
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):
|
def validate(self, value, this, context, object_store, default=None):
|
||||||
if default is None:
|
if default is None:
|
||||||
@ -51,8 +51,8 @@ class Spec(object):
|
|||||||
return self._has_default
|
return self._has_default
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def usage(self):
|
||||||
return self._type
|
return self._usage
|
||||||
|
|
||||||
|
|
||||||
class PropertySpec(Spec):
|
class PropertySpec(Spec):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user