From 711e689408ee9208233ed62b60f611f6ce948e73 Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Wed, 9 Sep 2015 17:19:43 +0300 Subject: [PATCH] Fixed incorrect MuranoPL names for some of Python-based methods When method that was defined in Python get registered in MuranoPL it name changes according to yaql conventions (and thus report_error becomes reportError). However this translation was buggy because 1. It didn't respect dsl.name('name') decorator that was supposed to override default behavior 2. It didn't strip underscores from the right of the name as yaql usually does (that prevent from name collisions in Python) Because of those issues applications that relied on StatusReporter::report_error method became broken. This commit fixes both of the issues with name translation. Change-Id: I84d4bd4df1af5bbe150f89c096afd8c52ad3da1a Closes-Bug: #1493875 --- murano/dsl/murano_package.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/murano/dsl/murano_package.py b/murano/dsl/murano_package.py index aa924b65..b2abb8b6 100644 --- a/murano/dsl/murano_package.py +++ b/murano/dsl/murano_package.py @@ -108,10 +108,15 @@ class MuranoPackage(dsl_types.MuranoPackage): method = getattr(cls, method_name) if not inspect.ismethod(method): continue - m_class.add_method( + # TODO(slagun): update the code below to use yaql native + # method for this when https://review.openstack.org/#/c/220748/ + # will get merged and Murano requirements bump to corresponding + # yaql version + method_name_alias = (getattr( + method, '__murano_name', None) or yaql_integration.CONVENTION.convert_function_name( - method_name), - method) + method_name.rstrip('_'))) + m_class.add_method(method_name_alias, method) self._imported_types.add(cls) return m_class