Parses a command (string or list of args), adds the required arguments, and replaces executable with full path
(command)
| 32 | |
| 33 | |
| 34 | def _parse_command(command): |
| 35 | '''Parses a command (string or list of args), adds the required arguments, and replaces executable with full path''' |
| 36 | if isinstance(command, list): |
| 37 | args = command |
| 38 | elif isinstance(command, str): |
| 39 | args = command.split() |
| 40 | else: |
| 41 | raise ValueError(f'command must be a string or list, not {type(command)}') |
| 42 | |
| 43 | packer = shutil.which('packer') |
| 44 | |
| 45 | if args[0] == 'packer': |
| 46 | args.pop(0) |
| 47 | |
| 48 | if args[0] != packer: |
| 49 | args = [packer] + args |
| 50 | |
| 51 | return args |
| 52 | |
| 53 | |
| 54 | def get_vars(image): |
no outgoing calls
no test coverage detected