def execute(self): parser = shell.CmdlineParser(self.cmdline_options) command = ([self._locate_binary(self.chef_binary)] + parser.short_arglist()) exit_code = shell.shell_out(command) sys.exit(exit_code)
def execute(self): parser = shell.CmdlineParser(self.cmdline_options) args_dict = vars(parser.raw_parser.parse_args()) args_dict['minimal-ohai'] = args_dict.pop('minimal_ohai') recipe_file = args_dict.pop('recipe_file') # We run one-off command ignoring recipe_file command = ([self.locate_binary(self.chef_binary)] + # pylint: disable=import-error parser.short_arglist(kwargs=args_dict)) # We execute from a recipe, no execute is given if recipe_file and args_dict['execute'] is None: # recipe file is the first positional argument command.insert(1, recipe_file) exit_code = shell.shell_out(command) sys.exit(exit_code)
def execute(self): parser = shell.CmdlineParser(self.cmdline_options) args_dict = vars(parser.raw_parser.parse_args()) args_dict['minimal-ohai'] = args_dict.pop('minimal_ohai') recipe_file = args_dict.pop('recipe_file') # We run one-off command ignoring recipe_file command = ([self.locate_binary(self.chef_binary)] + parser.short_arglist(kwargs=args_dict)) # We execute from a recipe, no execute is given if recipe_file and args_dict['execute'] is None: # recipe file is the first positional argument command.insert(1, recipe_file) exit_code = shell.shell_out(command) sys.exit(exit_code)
#!/usr/bin/env python2.7 import sys from lib import shellhelpers as shell def _locate_ohai(): return 'ohai' if __name__ == '__main__': # this is a workaround since we use run-remote and it # passes missing command as None in argv. command = ([_locate_ohai()] + [i for i in sys.argv[1:] if i != 'None']) sys.exit(shell.shell_out(command))
def execute(self): parser = shell.CmdlineParser(self.cmdline_options) command = ([self.locate_binary(self.chef_binary)] + # pylint: disable=import-error parser.short_arglist()) exit_code = shell.shell_out(command) sys.exit(exit_code)