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
This commit is contained in:
Stan Lagun 2015-09-09 17:19:43 +03:00
parent 89403ed23f
commit 711e689408
1 changed files with 8 additions and 3 deletions

View File

@ -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