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:
Stan Lagun 2014-06-09 21:02:50 +04:00 committed by Alexander Tivelkov
parent 45f002010a
commit 504a8a6039
2 changed files with 6 additions and 6 deletions

View File

@ -16,6 +16,7 @@
import json as jsonlib
import yaml as yamllib
import murano.dsl.helpers as helpers
import murano.dsl.murano_object as murano_object
if hasattr(yamllib, 'CSafeLoader'):
@ -44,10 +45,9 @@ yaml_loader.add_constructor(u'tag:yaml.org,2002:timestamp',
class ResourceManager(murano_object.MuranoObject):
def initialize(self, package_loader, _context, _class):
if _class is None:
_class = _context.get_data('$')
self._package = package_loader.get_package(_class.type.package.name)
def initialize(self, package_loader, _context):
murano_class = helpers.get_type(_context)
self._package = package_loader.get_package(murano_class.package.name)
def string(self, name):
path = self._package.get_resource(name)

View File

@ -41,9 +41,9 @@ def register(class_loader, package_loader):
@murano_class.classname('io.murano.system.Resources')
class ResourceManagerWrapper(resource_manager.ResourceManager):
def initialize(self, _context, _class=None):
def initialize(self, _context):
super(ResourceManagerWrapper, self).initialize(
package_loader, _context, _class)
package_loader, _context)
class_loader.import_class(agent.Agent)
class_loader.import_class(agent_listener.AgentListener)