MCPcopy Create free account
hub / github.com/Azure/dev-box-images / _parse_command

Function _parse_command

builder/packer.py:34–51  ·  view source on GitHub ↗

Parses a command (string or list of args), adds the required arguments, and replaces executable with full path

(command)

Source from the content-addressed store, hash-verified

32
33
34def _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
54def get_vars(image):

Callers 6

get_varsFunction · 0.70
initFunction · 0.70
buildFunction · 0.70
get_vars_asyncFunction · 0.70
init_asyncFunction · 0.70
build_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected