From aba0bd3077ed3ed6679ab7ec8c27de31250e7fe7 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand <benjamin.bertrand@esss.se> Date: Mon, 20 Aug 2018 21:33:07 +0200 Subject: [PATCH] Pass ztp_stack var to trigger_ztp_configuration New variable required to generate ZTP configuration. Note that we can only pass strings with extra_vars in AWX API (no list or dict). JIRA INFRA-458 #action In Progress --- app/tasks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/tasks.py b/app/tasks.py index 3f5fca6..42e15e2 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -120,11 +120,13 @@ 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}'", ] job_template = current_app.config["AWX_ZTP_CONFIGURATION"] current_app.logger.info( -- GitLab