Пример #1
0
    def __dag_run(self):
        # Get clean environment
        env = Env(initial_env=self._env.env_final(),
                  env_prefix=self._config['app']['env_prefix'])
        env.unload_packages()
        env.unload_release()
        env.unload_app()
        env.load_app(self._config['app'])
        env.load_release(self._config['scenario'], self._config['option'],
                         self._config['release'])

        selector = InstallSelector(self._config)
        processor = MultiThreadProcessor()
        executor = InstallExecutor(self._config, env.env_final())

        start_time = datetime.datetime.utcnow()

        with Handler(self._config['release_path']['handler_python_dir']):
            dag_run(self.__dag,
                    selector=selector,
                    processor=processor,
                    executor=executor)

        end_time = datetime.datetime.utcnow()

        self._config['release_status']['install'] = {}
        self._config['release_status']['install']['start'] = start_time
        self._config['release_status']['install']['end'] = end_time
        self._config['release_status']['install']['finished'] = True
        self._config['release_status']['option'] = {}
        for opt in self._config['release_install']['options_to_save']:
            if opt in self._config['option']:
                self._config['release_status']['option'][opt] = self._config[
                    'option'][opt]

        safe_mkdir(self._config['release_path']['status_dir'])
        self._config['release_status'].save_to_file(
            self._config['release_path']['status_file'])
Пример #2
0
    def execute(self, check_type):
        env = Env(initial_env=self._env.env_final(),
                  env_prefix=self._config['app']['env_prefix'])
        env.unload_packages()
        env.unload_release()
        env.unload_app()
        env.load_app(self._config['app'])
        env.load_release(self._config['scenario'], self._config['option'],
                         self._config['release'])

        missing = {}

        with Handler(self._config['release_path']['handler_python_dir']) as h:
            for category in self._config['package_check']:
                for package, value in self._config['package_check'][
                        category].items():
                    if not self.__check_package(h, env.env_final(),
                                                value['config'], check_type):
                        missing.setdefault(package, [])
                        missing[package].append(category)

            self.__check_summary(h, missing, check_type)

        return missing