def plan(self, force=False, sys_path=None): """Run the CFNgin plan action. Args: force (bool): Explicitly enable the action even if an environment file is not found. sys_path (Optional[str]): Explicitly define a path to work in. If not provided, ``self.sys_path`` is used. """ if self.should_skip(force): return if not sys_path: sys_path = self.sys_path config_file_names = self.find_config_files(sys_path=sys_path) with SafeHaven(environ=self.__ctx.env_vars): for config_name in config_file_names: logger = PrefixAdaptor(os.path.basename(config_name), LOGGER) logger.notice("plan (in progress)") with SafeHaven(argv=["stacker", "diff", config_name]): ctx = self.load(config_name) action = diff.Action( context=ctx, provider_builder=self._get_provider_builder( ctx.config.service_role), ) action.execute() logger.success("plan (complete)")
def deploy(self, force=False, sys_path=None): """Run the CFNgin deploy action. Args: force (bool): Explicitly enable the action even if an environment file is not found. sys_path (Optional[str]): Explicitly define a path to work in. If not provided, ``self.sys_path`` is used. """ if self.should_skip(force): return if not sys_path: sys_path = self.sys_path config_file_names = self.find_config_files(sys_path=sys_path) with SafeHaven(environ=self.__ctx.env_vars, sys_modules_exclude=["awacs", "troposphere"]): for config_name in config_file_names: logger = PrefixAdaptor(os.path.basename(config_name), LOGGER) logger.notice("deploy (in progress)") with SafeHaven( argv=["stacker", "build", config_name], sys_modules_exclude=["awacs", "troposphere"], ): ctx = self.load(config_name) action = build.Action( context=ctx, provider_builder=self._get_provider_builder( ctx.config.service_role), ) action.execute(concurrency=self.concurrency, tail=self.tail) logger.success("deploy (complete)")
def destroy(self, force=False, sys_path=None): """Run the CFNgin destroy action. Args: force (bool): Explicitly enable the action even if an environment file is not found. syspath (Optional[str]): Explicitly define a path to work in. If not provided, ``self.sys_path`` is used. """ if self.should_skip(force): return if not sys_path: sys_path = self.sys_path config_file_names = self.find_config_files(sys_path=sys_path) # destroy should run in reverse to handle dependencies config_file_names.reverse() with SafeHaven(environ=self.__ctx.env_vars): for config_name in config_file_names: logger = PrefixAdaptor(os.path.basename(config_name), LOGGER) logger.notice('destroy (in progress)') with SafeHaven(argv=['stacker', 'destroy', config_name]): ctx = self.load(config_name) action = destroy.Action( context=ctx, provider_builder=self._get_provider_builder( ctx.config.service_role)) action.execute(concurrency=self.concurrency, force=True, tail=self.tail) logger.success('destroy (complete)')