Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge 0a41cf2 into c5c508d
Browse files Browse the repository at this point in the history
  • Loading branch information
hdiogenes committed Dec 11, 2019
2 parents c5c508d + 0a41cf2 commit c14ddef
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions kytos/core/controller.py
Expand Up @@ -85,7 +85,7 @@ def __init__(self, options=None, loop=None):
#: dict: mapping of events and event listeners.
#:
#: The key of the dict is a KytosEvent (or a string that represent a
#: regex to match agains KytosEvents) and the value is a list of
#: regex to match against KytosEvents) and the value is a list of
#: methods that will receive the referenced event
self.events_listeners = {'kytos/core.connection.new':
[self.new_connection]}
Expand Down Expand Up @@ -772,21 +772,25 @@ def load_napp(self, username, napp_name):
username, napp_name, err)
return
except FileNotFoundError as err:
msg = "NApp module not found, assuming it's a meta napp: %s"
msg = "NApp module not found, assuming it's a meta-napp: %s"
self.log.warning(msg, err.filename)
return

napp = napp_module.Main(controller=self)

self.napps[(username, napp_name)] = napp
try:
napp = napp_module.Main(controller=self)
except:
self.log.critical("NApp initialization failed: %s/%s",
username, napp_name, exc_info=True)
else:
self.napps[(username, napp_name)] = napp

napp.start()
self.api_server.register_napp_endpoints(napp)
napp.start()
self.api_server.register_napp_endpoints(napp)

# pylint: disable=protected-access
for event, listeners in napp._listeners.items():
self.events_listeners.setdefault(event, []).extend(listeners)
# pylint: enable=protected-access
# pylint: disable=protected-access
for event, listeners in napp._listeners.items():
self.events_listeners.setdefault(event, []).extend(listeners)
# pylint: enable=protected-access

def pre_install_napps(self, napps, enable=True):
"""Pre install and enable NApps.
Expand Down

0 comments on commit c14ddef

Please sign in to comment.