Allow specifying arbitrary script_args on CLI
Allow the specifying of arbitrary provisioner script install() args on the provisioner create CLI, either overriding or adding additional per-VM arguments to those found in the profile. Reference example is setting a "vm_fqdn" on a per-run basis. Closes #100
This commit is contained in:
@ -1026,7 +1026,7 @@ def delete_profile(name):
|
||||
#
|
||||
# Main VM provisioning function - executed by the Celery worker
|
||||
#
|
||||
def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
|
||||
def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_run_args=[]):
|
||||
# Runtime imports
|
||||
import time
|
||||
import importlib
|
||||
@ -1542,6 +1542,13 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
|
||||
argument_name, argument_data = argument.split('=')
|
||||
script_arguments[argument_name] = argument_data
|
||||
|
||||
# Parse the runtime arguments
|
||||
for argument in script_run_args:
|
||||
argument_name, argument_data = argument.split('=')
|
||||
script_arguments[argument_name] = argument_data
|
||||
|
||||
print("Script arguments: {}".format(script_arguments))
|
||||
|
||||
# Run the script
|
||||
try:
|
||||
installer_script.install(
|
||||
|
Reference in New Issue
Block a user