Esempio n. 1
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            discover.LOG.warning(
                "OpenStack plugins moved to the separate package "
                "(see https://pypi.org/project/rally-openstack). In-tree "
                "OpenStack plugins will be removed from the Rally main package"
                " soon.")
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
Esempio n. 2
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        # NOTE(andreykurilin): `rally.plugins.common` includes deprecated
        #   modules. As soon as they will be removed the direct import of
        #   validators should be replaced by
        #
        #       discover.import_modules_from_package("rally.plugins.common")
        from rally.plugins.common import validators  # noqa: F401

        discover.import_modules_from_package("rally.plugins.task")
        discover.import_modules_from_package("rally.plugins.verification")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
Esempio n. 3
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            discover.LOG.warning(
                "OpenStack plugins moved to the separate package "
                "(see https://pypi.org/project/rally-openstack). In-tree "
                "OpenStack plugins will be removed from the Rally main package"
                " soon.")
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
Esempio n. 4
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
Esempio n. 5
0
    def test_register_options_from_path(self, mock_register_opts):

        opts.register_options_from_path("unexisting.path.without.method.name")
        self.assertFalse(mock_register_opts.called)
        self.assertIsEmpty(opts._registered_paths)

        opts.register_options_from_path("unexisting.path:method_name")
        self.assertFalse(mock_register_opts.called)
        self.assertIsEmpty(opts._registered_paths)

        opts.register_options_from_path(
            "tests.unit.common.test_opts:fake_list_opts")
        mock_register_opts.assert_called_once_with(fake_list_opts().items())
        self.assertIn("tests.unit.common.test_opts:fake_list_opts",
                      opts._registered_paths)