diff --git a/app/tasks.py b/app/tasks.py index 42e15e2149cbc87fc276618bf22db3529b0fbc83..f85b4f28e7e09b9c5572ca99f380d0eb2940057a 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -120,14 +120,15 @@ def trigger_vm_creation(name, interface, memory, cores): def trigger_ztp_configuration(host): """Trigger a job to generate a switch ZTP configuration""" - ztp_stack = ",".join([item.serial_number for item in host.stack_members()]) extra_vars = [ f"ztp_host={host.name}", f"ztp_ip={host.main_interface.ip}", f"ztp_mac={host.main_interface.mac}", f"ztp_model={host.model}", - f"ztp_stack='{ztp_stack}'", ] + ztp_stack = ",".join([item.serial_number for item in host.stack_members()]) + if ztp_stack: + extra_vars.append(f"ztp_stack={ztp_stack}") job_template = current_app.config["AWX_ZTP_CONFIGURATION"] current_app.logger.info( f"Launch new job to generate ZTP configuration for {host.name} device: {job_template} with {extra_vars}"