Make sys:Resources class use resources belonging to its owner
io.murano.system.Resources class tried to access resource files belonging to the instance's class rather than the class that owns sys:Resources instance. So when derived class is located in different package than its base class inherited methods become using resources of derived class package. Closes bug: #1328176 Change-Id: I85719c612ad0d62c82f83f9e584278fba0825688
This commit is contained in:
parent
45f002010a
commit
504a8a6039
@ -16,6 +16,7 @@
|
|||||||
import json as jsonlib
|
import json as jsonlib
|
||||||
import yaml as yamllib
|
import yaml as yamllib
|
||||||
|
|
||||||
|
import murano.dsl.helpers as helpers
|
||||||
import murano.dsl.murano_object as murano_object
|
import murano.dsl.murano_object as murano_object
|
||||||
|
|
||||||
if hasattr(yamllib, 'CSafeLoader'):
|
if hasattr(yamllib, 'CSafeLoader'):
|
||||||
@ -44,10 +45,9 @@ yaml_loader.add_constructor(u'tag:yaml.org,2002:timestamp',
|
|||||||
|
|
||||||
|
|
||||||
class ResourceManager(murano_object.MuranoObject):
|
class ResourceManager(murano_object.MuranoObject):
|
||||||
def initialize(self, package_loader, _context, _class):
|
def initialize(self, package_loader, _context):
|
||||||
if _class is None:
|
murano_class = helpers.get_type(_context)
|
||||||
_class = _context.get_data('$')
|
self._package = package_loader.get_package(murano_class.package.name)
|
||||||
self._package = package_loader.get_package(_class.type.package.name)
|
|
||||||
|
|
||||||
def string(self, name):
|
def string(self, name):
|
||||||
path = self._package.get_resource(name)
|
path = self._package.get_resource(name)
|
||||||
|
@ -41,9 +41,9 @@ def register(class_loader, package_loader):
|
|||||||
|
|
||||||
@murano_class.classname('io.murano.system.Resources')
|
@murano_class.classname('io.murano.system.Resources')
|
||||||
class ResourceManagerWrapper(resource_manager.ResourceManager):
|
class ResourceManagerWrapper(resource_manager.ResourceManager):
|
||||||
def initialize(self, _context, _class=None):
|
def initialize(self, _context):
|
||||||
super(ResourceManagerWrapper, self).initialize(
|
super(ResourceManagerWrapper, self).initialize(
|
||||||
package_loader, _context, _class)
|
package_loader, _context)
|
||||||
|
|
||||||
class_loader.import_class(agent.Agent)
|
class_loader.import_class(agent.Agent)
|
||||||
class_loader.import_class(agent_listener.AgentListener)
|
class_loader.import_class(agent_listener.AgentListener)
|
||||||
|
Loading…
Reference in New Issue
Block a user