Beispiel #1
0
    def top_level_cmd(self):
        try:
            compose_files = self.get_compose_files()
            config_path = get_config_path_from_options(
                ".",
                {},
                {"COMPOSE_FILE": compose_files},
            )

            os.environ["COMPOSE_FILE"] = compose_files

            for k, v in self.settings.items():
                if k == "CONFIGURATION_OPTIONAL_SCOPES":
                    continue
                if isinstance(v, bool):
                    v = f"{v}".lower()
                if isinstance(v, int):
                    v = str(v)
                os.environ[k] = v

            env = Environment()
            env.update(os.environ)

            project = get_project(os.getcwd(), config_path, environment=env)
            tlc = TopLevelCommand(project)
            yield tlc
        except Exception:  # noqa: B902
            raise
Beispiel #2
0
 def compose_project(cls):
     env = Environment(os.environ.copy())
     env.update(cls.COMPOSE_ENV)
     return get_project(cls.find_compose_path(),
                        project_name=cls.compose_project_name(),
                        environment=env)