diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-02-27 17:02:16 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-03-04 13:25:30 +0900 |
commit | caeaae639b4dba9404c6ad34a69eb4c94b0aff88 (patch) | |
tree | b6c0c52eefab5d9375e4f1dd0be9ea2fb3e9a906 | |
parent | 1875071ce2f96614a66fcd9c8eee431b83ec32b0 (diff) |
fix load_apps() in AppManager class
fix the following bug:
http://sourceforge.net/p/ryu/mailman/message/32022286/
Dependent services are not loaded properly with '_CONTEXTS'.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/base/app_manager.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py index e65a6f3b..31e99985 100644 --- a/ryu/base/app_manager.py +++ b/ryu/base/app_manager.py @@ -287,13 +287,19 @@ class AppManager(object): services = [] for key, context_cls in cls.context_iteritems(): - cls = self.contexts_cls.setdefault(key, context_cls) - assert cls == context_cls + v = self.contexts_cls.setdefault(key, context_cls) + assert v == context_cls if issubclass(context_cls, RyuApp): services.extend(get_dependent_services(context_cls)) - services.extend(get_dependent_services(cls)) + # we can't load an app that will be initiataed for + # contexts. + context_modules = map(lambda x: x.__module__, + self.contexts_cls.values()) + for i in get_dependent_services(cls): + if not i in context_modules: + services.append(i) if services: app_lists.extend(services) |