From b74597f4dd3e3bb1902678b51e8dbce64b8adf72 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Mon, 19 Nov 2018 15:17:28 -0500 Subject: [PATCH] fix bug when reverting non-default inventory prompts --- awx/ui/client/src/templates/prompt/prompt.service.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/awx/ui/client/src/templates/prompt/prompt.service.js b/awx/ui/client/src/templates/prompt/prompt.service.js index 150fd994dd..2ac79adaaf 100644 --- a/awx/ui/client/src/templates/prompt/prompt.service.js +++ b/awx/ui/client/src/templates/prompt/prompt.service.js @@ -180,6 +180,17 @@ function PromptService (Empty, $filter) { }); } + if (_.get(promptData, 'templateType') === 'workflow_job_template') { + if (_.get(launchData, 'inventory_id', null) === null) { + // It's possible to get here on a workflow job template with an inventory prompt and no + // default value by selecting an inventory, removing it, selecting a different inventory, + // and then reverting. A null inventory_id may be accepted by the API for prompted workflow + // inventories in the future, but for now they will 400. As such, we intercept that case here + // and remove it from the request data prior to launching. + delete launchData.inventory_id; + } + } + return launchData; };