Introduce MuranoPL/1.1 and 1.2

1.1 is the same as 1.0 but packages with format other than
MuranoPL/1.0 (or just 1.0) will be rejected by Murano Kilo.
As a result it will be possible to specify that application
require yaql 1.0 which was introduce in Liberty.

MuranoPL/1.2 differs in that it has yaql legacy mode turned
off and several functions are now cannot be called as
MuranoObject methods. It is recommended to start development
of new applications using 1.2 format

Change-Id: Ie68cc0c37f198c10eeac79ed349f9d9d420e038f
Implements-Blueprint: muranopl-format-version-upgrade
This commit is contained in:
Stan Lagun 2015-10-14 17:40:39 +03:00
parent d4dc8740bb
commit aa0e112461
5 changed files with 14 additions and 13 deletions

View File

@ -44,4 +44,5 @@ CORE_LIBRARY = 'io.murano'
CORE_LIBRARY_OBJECT = 'io.murano.Object'
RUNTIME_VERSION_1_0 = semantic_version.Version('1.0.0')
RUNTIME_VERSION_2_0 = semantic_version.Version('2.0.0')
RUNTIME_VERSION_1_1 = semantic_version.Version('1.1.0')
RUNTIME_VERSION_1_2 = semantic_version.Version('1.2.0')

View File

@ -183,7 +183,7 @@ def register(context, runtime_version):
context.register_function(equal)
context.register_function(not_equal)
if runtime_version < constants.RUNTIME_VERSION_2_0:
if runtime_version <= constants.RUNTIME_VERSION_1_1:
context2 = context.create_child_context()
for t in ('id', 'cast', 'super', 'psuper', 'type'):
for spec in utils.to_extension_method(t, context):

View File

@ -37,7 +37,7 @@ ENGINE_10_OPTIONS = {
'yaql.iterableDicts': True
}
ENGINE_20_OPTIONS = {
ENGINE_12_OPTIONS = {
'yaql.limitIterators': constants.ITERATORS_LIMIT,
'yaql.memoryQuota': constants.EXPRESSION_MEMORY_QUOTA,
'yaql.convertSetsToLists': True,
@ -50,8 +50,8 @@ def _create_engine(runtime_version):
engine_factory.insert_operator(
'.', True, ':', factory.OperatorType.BINARY_LEFT_ASSOCIATIVE, True)
options = (ENGINE_10_OPTIONS
if runtime_version < constants.RUNTIME_VERSION_2_0
else ENGINE_20_OPTIONS)
if runtime_version <= constants.RUNTIME_VERSION_1_1
else ENGINE_12_OPTIONS)
return engine_factory.create(options=options)
@ -61,10 +61,10 @@ def _finalize(obj, context):
CONVENTION = conventions.CamelCaseConvention()
ENGINE_10 = _create_engine(constants.RUNTIME_VERSION_1_0)
ENGINE_20 = _create_engine(constants.RUNTIME_VERSION_2_0)
ENGINE_12 = _create_engine(constants.RUNTIME_VERSION_1_2)
ROOT_CONTEXT_10 = legacy.create_context(
convention=CONVENTION, finalizer=_finalize)
ROOT_CONTEXT_20 = yaql.create_context(
ROOT_CONTEXT_12 = yaql.create_context(
convention=CONVENTION, finalizer=_finalize)
@ -94,17 +94,17 @@ def create_empty_context():
@helpers.memoize
def create_context(runtime_version):
if runtime_version < constants.RUNTIME_VERSION_2_0:
if runtime_version <= constants.RUNTIME_VERSION_1_1:
context = ROOT_CONTEXT_10.create_child_context()
else:
context = ROOT_CONTEXT_20.create_child_context()
context = ROOT_CONTEXT_12.create_child_context()
context[constants.CTX_YAQL_ENGINE] = choose_yaql_engine(runtime_version)
return yaql_functions.register(context, runtime_version)
def choose_yaql_engine(runtime_version):
return (ENGINE_10 if runtime_version <= constants.RUNTIME_VERSION_1_0
else ENGINE_20)
return (ENGINE_10 if runtime_version <= constants.RUNTIME_VERSION_1_1
else ENGINE_12)
def parse(expression, runtime_version):

View File

@ -206,7 +206,7 @@ def get_context(runtime_version):
context.register_function(config_default)
context.register_function(logger)
if runtime_version < constants.RUNTIME_VERSION_2_0:
if runtime_version <= constants.RUNTIME_VERSION_1_1:
context.register_function(substr)
context.register_function(first_or_default)

View File

@ -65,7 +65,7 @@ def load_from_file(archive_path, target_dir=None, drop_dir=False):
def load_from_dir(source_directory, filename='manifest.yaml'):
formats = {
'MuranoPL': {
('1.0.0', '1.0.0'): murano.packages.mpl_package.MuranoPlPackage,
('1.0.0', '1.2.0'): murano.packages.mpl_package.MuranoPlPackage,
},
'Heat.HOT': {
('1.0.0', '1.0.0'): murano.packages.hot_package.HotPackage