Пример #1
0
    def execute(cls, helm_command):
        """Executed the command provided in the init. Only allowed to be executed once!"""

        # initialize the instance of the provider
        instance = cls(helm_command)

        # start by creating a command line arguments list with the command being first
        args = list([instance._helm_binary])

        # if command has a space in it (like get manifests), split on space
        # and append each segment as it's own list item to make `call` happy
        for command_segment in instance._helm_command.command.split(' '):
            args.append(command_segment)

        for arg in instance._helm_command.arguments:
            args.append(arg)

        call_response = call(args, path=Config().course_base_directory)

        return HelmCmdResponse(
            exit_code=call_response.exitcode,
            stdout=call_response.stdout,
            stderr=call_response.stderr,
            command=helm_command,
        )
Пример #2
0
    def execute(cls, helm_command):
        """Executed the command provided in the init. Only allowed to be executed once!"""

        # initialize the instance of the provider
        instance = cls(helm_command)

        # start by creating a command line arguments list with the command being first
        args = list([instance._helm_binary])
        args.append(instance._helm_command.command)
        for arg in instance._helm_command.arguments:
            args.append(arg)

        call_response = call(args)

        return HelmCmdResponse(
            exit_code=call_response.exitcode,
            stdout=call_response.stdout,
            stderr=call_response.stderr,
            command=helm_command,
        )
Пример #3
0
 def test_call_command(self):
     """Call whoami and expect an output"""
     p = call('whoami', shell=False, executable=None, path=None)
     self.assertIsInstance(p, Response)
     self.assertIsInstance(p.stdout, str)
     self.assertIsInstance(p.stderr, str)