Exemplo n.º 1
0
    def load(self, resolve=True, skip_actors_discovery=False):
        """
        Load all known repositories.

        :param resolve: Whether or not to perform the resolving of model references
        :type resolve: bool
        :param skip_actors_discovery: specifies whether to skip discovery process of the actors
            When we testing actors, we're directly injecting the actor context, so we don't
            need to inject it during the repo loading. This option helps to solve this problem.
        :type skip_actors_discovery: bool
        """
        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.INITIAL)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.MODELS)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.LIBRARIES)

        for repo in self._repos.values():
            repo.load(resolve=False,
                      stage=_LoadStage.ACTORS,
                      skip_actors_discovery=skip_actors_discovery)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.WORKFLOWS)

        if resolve:
            resolve_model_references()
Exemplo n.º 2
0
    def load(self, resolve=True):
        """
        Load all known repositories.

        :param resolve: Whether or not to perform the resolving of model references
        :type resolve: bool
        """
        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.INITIAL)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.MODELS)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.LIBRARIES)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.ACTORS)

        for repo in self._repos.values():
            repo.load(resolve=False, stage=_LoadStage.WORKFLOWS)

        if resolve:
            from leapp.models import resolve_model_references
            resolve_model_references()
Exemplo n.º 3
0
    def load(self, resolve=True, stage=None):
        """
        Loads the repository resources

        :param resolve: Decides whether or not to perform the resolving of model references
        :type resolve: bool
        :param stage: Stage to load - Required for repository managers
        :type stage: _LoadStage value
        """
        if not stage or stage is _LoadStage.INITIAL:
            self.log.debug("Loading repository %s", self.name)
            self.log.debug("Loading tag modules")
            self._load_modules(self.tags, 'leapp.tags')
            self.log.debug("Loading topic modules")
            self._load_modules(self.topics, 'leapp.topics')

        if not stage or stage is _LoadStage.MODELS:
            self.log.debug("Loading model modules")
            self._load_modules(self.models, 'leapp.models')
            if resolve:
                from leapp.models import resolve_model_references
                resolve_model_references()

        if not stage or stage is _LoadStage.LIBRARIES:
            self.log.debug("Extending PATH for common tool paths")
            self._extend_environ_paths('PATH', self.tools)
            self.log.debug(
                "Extending LEAPP_COMMON_TOOLS for common tool paths")
            self._extend_environ_paths('LEAPP_COMMON_TOOLS', self.tools)
            self.log.debug(
                "Extending LEAPP_COMMON_FILES for common file paths")
            self._extend_environ_paths('LEAPP_COMMON_FILES', self.files)

            if not leapp.libraries.common.LEAPP_BUILTIN_COMMON_INITIALIZED:
                self.log.debug("Loading built-in common libraries")
                self._load_libraries(
                    path=(os.path.dirname(leapp.libraries.common.__file__) +
                          '/', ))
                leapp.libraries.common.LEAPP_BUILTIN_COMMON_INITIALIZED = True

            self.log.debug("Loading repository provided common libraries")
            self._load_libraries()

        if not stage or stage is _LoadStage.ACTORS:
            self.log.debug("Running actor discovery")
            for actor in self.actors:
                actor.discover()

        if not stage or stage is _LoadStage.WORKFLOWS:
            self.log.debug("Loading workflow modules")
            self._load_modules(self.workflows, 'leapp.workflows')
Exemplo n.º 4
0
    def load(self, resolve=True, stage=None, skip_actors_discovery=False):
        """
        Loads the repository resources

        :param resolve: Decides whether or not to perform the resolving of model references
        :type resolve: bool
        :param stage: Stage to load - Required for repository managers
        :type stage: _LoadStage value
        """
        if not stage or stage is _LoadStage.INITIAL:
            self.log.debug("Loading repository %s", self.name)
            self.log.debug("Loading tag modules")
            self._load_modules(self.tags, 'leapp.tags')
            self.log.debug("Loading topic modules")
            self._load_modules(self.topics, 'leapp.topics')

        if not stage or stage is _LoadStage.MODELS:
            self.log.debug("Loading model modules")
            self._load_modules(self.models, 'leapp.models')
            if resolve:
                resolve_model_references()

        if not stage or stage is _LoadStage.LIBRARIES:
            self.log.debug("Extending PATH for common tool paths")
            self._extend_environ_paths('PATH', self.tools)
            self.log.debug(
                "Extending LEAPP_COMMON_TOOLS for common tool paths")
            self._extend_environ_paths('LEAPP_COMMON_TOOLS', self.tools)
            self.log.debug(
                "Extending LEAPP_COMMON_FILES for common file paths")
            self._extend_environ_paths('LEAPP_COMMON_FILES', self.files)
            self.log.debug(
                "Installing repository provided common libraries loader hook")
            sys.meta_path.append(
                LeappLibrariesFinder(module_prefix='leapp.libraries.common',
                                     paths=self.libraries))
            sys.meta_path.append(
                LeappLibrariesFinder(module_prefix='leapp.workflows.api',
                                     paths=self.apis))

        if not skip_actors_discovery:
            if not stage or stage is _LoadStage.ACTORS:
                self.log.debug("Running actor discovery")
                for actor in self.actors:
                    actor.discover()

        if not stage or stage is _LoadStage.WORKFLOWS:
            self.log.debug("Loading workflow modules")
            self._load_modules(self.workflows, 'leapp.workflows')