On Thu, 27 Feb 2014 14:45:39 +0900
FUJITA Tomonori <[email protected]> wrote:

> 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 <[email protected]>
> ---
>  ryu/base/app_manager.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
> index e65a6f3..286ff1c 100644
> --- a/ryu/base/app_manager.py
> +++ b/ryu/base/app_manager.py
> @@ -287,8 +287,8 @@ 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))
> -- 

Oops, found a bug. Here's an updated version.

diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index e65a6f3..31e9998 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)
 

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to