# Path: opsmgr/common/utils.py
# def entry_exit(exclude_index=None, exclude_name=None, log_name=None, level=logging.INFO):
#     """
#     it's a decorator that to add entry and exit log for a function
# 
#     input:
#     excludeIndex -- the index of params that you don't want to be record
#     excludeName -- the name of dictionary params that you don't wnat to be record
#     log_name -- name of the log to write the logging to.
#     level -- the logging level to log the entry/exit with.  default is INFO level
#     """
# 
#     def f(func):
#         @functools.wraps(func)
#         def wrapper(*args, **kwargs):
# 
#             args_for_print = []
#             tmp_index = 0
#             arg_len = len(args)
#             while tmp_index < arg_len:
#                 if tmp_index not in exclude_index:
#                     args_for_print.append(args[tmp_index])
#                 tmp_index += 1
# 
#             kwargs_for_print = {}
#             for a in kwargs:
#                 if a in exclude_name:
#                     continue
#                 else:
#                     kwargs_for_print[a] = kwargs[a]
# 
#             logging.getLogger(log_name).log(level,
#                                             "%s::Entry params %s %s", func.__name__, "{}".format(
#                                                 args_for_print), "{}".format(kwargs_for_print))
#             result = func(*args, **kwargs)
#             logging.getLogger(log_name).log(level,
#                                             "%s::Exit %s ", func.__name__, "{}".format(result))
#             return result
#         return wrapper
#     return f
# 
# def load_plugin_by_namespace(namespace):
#     plugins = {}
#     extensions = extension.ExtensionManager(namespace=namespace)
# 
#     for ext in extensions:
#         plugins[ext.name] = ext.plugin()
#     return plugins


from opsmgr.common.utils import entry_exit, load_plugin_by_namespace
        plugins = PluginApplication._load_operations_plugins()
        for _plugin_name, plugin_class in plugins.items():
            plugin_app = plugin_class.get_application_url()
            if plugin_app is not None:
                plugin_apps.append(plugin_app)
        return plugin_apps

    @staticmethod
    @entry_exit(exclude_index=[], exclude_name=[])
    def get_plugins_status():
        """ Returns two list of Strings for critical and warning messages from
            all plugins on the localhost.
        """
        critical_messages = []
        warning_messages = []
        plugins = PluginApplication._load_operations_plugins()
        for _plugin_name, plugin_class in plugins.items():
            (crit, warn) = plugin_class.get_status()
            if crit is not None:
                critical_messages.extend(crit)
            if warn is not None:
                warning_messages.extend(warn)
        return (critical_messages, warning_messages)

    @staticmethod
    def _load_operations_plugins():
        """
        Find the operations plugins and return them as a
        dictonary[name]=plugin class
        """

# Path: opsmgr/common/utils.py
# def entry_exit(exclude_index=None, exclude_name=None, log_name=None, level=logging.INFO):
#     """
#     it's a decorator that to add entry and exit log for a function
# 
#     input:
#     excludeIndex -- the index of params that you don't want to be record
#     excludeName -- the name of dictionary params that you don't wnat to be record
#     log_name -- name of the log to write the logging to.
#     level -- the logging level to log the entry/exit with.  default is INFO level
#     """
# 
#     def f(func):
#         @functools.wraps(func)
#         def wrapper(*args, **kwargs):
# 
#             args_for_print = []
#             tmp_index = 0
#             arg_len = len(args)
#             while tmp_index < arg_len:
#                 if tmp_index not in exclude_index:
#                     args_for_print.append(args[tmp_index])
#                 tmp_index += 1
# 
#             kwargs_for_print = {}
#             for a in kwargs:
#                 if a in exclude_name:
#                     continue
#                 else:
#                     kwargs_for_print[a] = kwargs[a]
# 
#             logging.getLogger(log_name).log(level,
#                                             "%s::Entry params %s %s", func.__name__, "{}".format(
#                                                 args_for_print), "{}".format(kwargs_for_print))
#             result = func(*args, **kwargs)
#             logging.getLogger(log_name).log(level,
#                                             "%s::Exit %s ", func.__name__, "{}".format(result))
#             return result
#         return wrapper
#     return f
# 
# def load_plugin_by_namespace(namespace):
#     plugins = {}
#     extensions = extension.ExtensionManager(namespace=namespace)
# 
#     for ext in extensions:
#         plugins[ext.name] = ext.plugin()
#     return plugins


# Path: opsmgr/inventory/plugins.py
from opsmgr.common.utils import entry_exit, load_plugin_by_namespace

        plugins = PluginApplication._load_operations_plugins()
        for _plugin_name, plugin_class in plugins.items():
            plugin_app = plugin_class.get_application_url()
            if plugin_app is not None:
                plugin_apps.append(plugin_app)
        return plugin_apps

    @staticmethod
    @entry_exit(exclude_index=[], exclude_name=[])
    def get_plugins_status():
        """ Returns two list of Strings for critical and warning messages from
            all plugins on the localhost.
        """
        critical_messages = []
        warning_messages = []
        plugins = PluginApplication._load_operations_plugins()
        for _plugin_name, plugin_class in plugins.items():
            (crit, warn) = plugin_class.get_status()
            if crit is not None:
                critical_messages.extend(crit)
            if warn is not None:
                warning_messages.extend(warn)
        return (critical_messages, warning_messages)

    @staticmethod
    def _load_operations_plugins():
        """
        Find the operations plugins and return them as a
        dictonary[name]=plugin class
        """

        return load_plugin_by_namespace(I_OPERATIONS_PLUGINS)