- def __init__(self, dts, log, loop, on_add_config_agent, on_delete_config_agent):
+ def __init__(self, dts, log, loop, project, on_add_config_agent, on_delete_config_agent):
self._on_add_config_agent = on_add_config_agent
self._on_delete_config_agent = on_delete_config_agent
self._log.debug("creating config account handler")
self.cloud_cfg_handler = rift.mano.config_agent.ConfigAgentSubscriber(
self._on_add_config_agent = on_add_config_agent
self._on_delete_config_agent = on_delete_config_agent
self._log.debug("creating config account handler")
self.cloud_cfg_handler = rift.mano.config_agent.ConfigAgentSubscriber(
rift.mano.config_agent.ConfigAgentCallbacks(
on_add_apply=self.on_config_account_added,
on_delete_apply=self.on_config_account_deleted,
rift.mano.config_agent.ConfigAgentCallbacks(
on_add_apply=self.on_config_account_added,
on_delete_apply=self.on_config_account_deleted,
- self._dts, self._log, self._loop, self._on_config_agent, self._on_config_agent_delete)
+ self._dts, self._log, self._loop, parent._project,
+ self._on_config_agent, self._on_config_agent_delete)
self._plugin_instances = {}
self._default_account_added = False
@asyncio.coroutine
def invoke_config_agent_plugins(self, method, nsr, vnfr, *args):
# Invoke the methods on all config agent plugins registered
self._plugin_instances = {}
self._default_account_added = False
@asyncio.coroutine
def invoke_config_agent_plugins(self, method, nsr, vnfr, *args):
# Invoke the methods on all config agent plugins registered
rc = yield from agent.invoke(method, nsr, vnfr, *args)
break
except Exception as e:
rc = yield from agent.invoke(method, nsr, vnfr, *args)
break
except Exception as e:
- self._log.error("Error invoking {} on {} : {}".
- format(method, agent.name, e))
- raise
+ self._log.exception("Error invoking {} on {} : {}".
+ format(method, agent.name, e))
+ raise e
self._log.info("vnfr({}), method={}, return rc={}"
.format(vnfr.name, method, rc))
return rc
def get_vnfr_config_agent(self, vnfr):
self._log.info("vnfr({}), method={}, return rc={}"
.format(vnfr.name, method, rc))
return rc
def get_vnfr_config_agent(self, vnfr):
else:
# Otherwise, instantiate a new plugin using the config agent account
self._log.debug("Instantiting new config agent using class: %s", cap_inst)
else:
# Otherwise, instantiate a new plugin using the config agent account
self._log.debug("Instantiting new config agent using class: %s", cap_inst)
- new_instance = cap_inst(self._dts, self._log, self._loop, config_agent)
+ new_instance = cap_inst(self._dts, self._log, self._loop,
+ self._ConfigManagerConfig._project, config_agent)
self._plugin_instances[cap_name] = new_instance
# TODO (pjoseph): See why this was added, as this deletes the
self._plugin_instances[cap_name] = new_instance
# TODO (pjoseph): See why this was added, as this deletes the
def _on_config_agent_delete(self, config_agent):
self._log.debug("Got nsm plugin config agent delete, account: %s, type: %s",
config_agent.name, config_agent.account_type)
def _on_config_agent_delete(self, config_agent):
self._log.debug("Got nsm plugin config agent delete, account: %s, type: %s",
config_agent.name, config_agent.account_type)
if cap_name in self._plugin_instances:
self._log.debug("Config agent nsm plugin exists, deleting it.")
del self._plugin_instances[cap_name]
if cap_name in self._plugin_instances:
self._log.debug("Config agent nsm plugin exists, deleting it.")
del self._plugin_instances[cap_name]
def register(self):
self._log.debug("Registering for config agent nsm plugin manager")
yield from self._config_handler.register()
def register(self):
self._log.debug("Registering for config agent nsm plugin manager")
yield from self._config_handler.register()
def set_config_agent(self, nsr, vnfr, method):
if method == 'juju':
agent_type = 'juju'
def set_config_agent(self, nsr, vnfr, method):
if method == 'juju':
agent_type = 'juju'
for agent in self._plugin_instances:
if self._plugin_instances[agent].agent_type == agent_type:
self._plugin_instances[agent].add_vnfr_managed(vnfr)
for agent in self._plugin_instances:
if self._plugin_instances[agent].agent_type == agent_type:
self._plugin_instances[agent].add_vnfr_managed(vnfr)