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. 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_files = self.find_config_files(sys_path=sys_path) with environ(self.__ctx.env_vars): for config in config_files: ctx = self.load(config) LOGGER.info('%s: deploying...', os.path.basename(config)) with argv('stacker', 'build', ctx.config_path): action = build.Action( context=ctx, provider_builder=self._get_provider_builder( ctx.config.service_role ) ) action.execute(concurrency=self.concurrency, tail=self.tail)
def test_argv(): """Test argv.""" orig_expected = ['runway', 'deploy'] override = ['stacker', 'build', 'test.yml'] assert sys.argv == orig_expected, 'validate original value' with argv(*override): assert sys.argv == override, 'validate override' assert sys.argv == orig_expected, 'validate value returned to original'
def test_argv(): """Test argv.""" orig_expected = ["runway", "deploy"] override = ["stacker", "build", "test.yml"] assert sys.argv == orig_expected, "validate original value" with argv(*override): assert sys.argv == override, "validate override" assert sys.argv == orig_expected, "validate value returned to original"
def handle(cls, name, args): # type: (str, Dict[str, Any]) -> None """Perform the actual test.""" base_dir = os.getcwd() if os.path.isfile(os.path.join(base_dir, '.yamllint')): yamllint_config = os.path.join(base_dir, '.yamllint') elif os.path.isfile(os.path.join(base_dir, '.yamllint.yml')): yamllint_config = os.path.join(base_dir, '.yamllint.yml') else: yamllint_config = os.path.join( os.path.dirname( os.path.dirname(os.path.dirname( os.path.abspath(__file__)))), 'templates', '.yamllint.yml') yamllint_options = ["--config-file=%s" % yamllint_config] yamllint_options.extend(cls.get_yamllint_options(base_dir)) with argv(*['yamllint'] + yamllint_options): runpy.run_module('yamllint', run_name='__main__')