Example #1
0
    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)
        options = parser.parse()
        install_method = options['method']

        if install_method not in self.SUPPORTED_METHODS:
            error = "Chef pack doesn't support the given "\
                    "installation method: {}\n".format(install_method)
            sys.stderr.write(error)
            sys.exit(1)

        del options['method']
        self.install(install_method, options)
Example #3
0
    def execute(self):
        self.parser = shell.CmdlineParser(self.cmdline_options)
        options = self.parser.parse()
        install_method = options['method']

        if not (install_method in self.SUPPORTED_METHODS):
            error = (
                "Chef pack doesn't support the given installation method: %s\n"
                % (install_method))
            sys.stderr.write(error)
            sys.exit(1)

        del options['method']
        self.install(install_method, options)
Example #4
0
    def execute(self):
        self.parser = shell.CmdlineParser(self.cmdline_options)
        options = self.parser.parse()
        install_method = [
            i for i in options.keys() if i in self.SUPPORTED_METHODS
        ]

        if len(install_method) > 1:
            sys.stderr.write(
                "You can't use more than one installation method!\n")
            sys.stderr.write("Choose one of the following methods: %s\n" %
                             ', '.join(self.SUPPORTED_METHODS))
            sys.exit(1)

        del (options[install_method[0]])
        self.install(install_method[0], options)
Example #5
0
    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)
Example #6
0
 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)