From b2162a5e7752bea1edd6a8dd78c89cd984d54288 Mon Sep 17 00:00:00 2001 From: Luis Toledo Date: Mon, 28 Oct 2019 16:02:12 -0300 Subject: [PATCH] fix error message --- .../ais/rundeck/HttpWorkflowNodeStepPlugin.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/ohio/ais/rundeck/HttpWorkflowNodeStepPlugin.java b/src/main/java/edu/ohio/ais/rundeck/HttpWorkflowNodeStepPlugin.java index c070cb5..7172743 100644 --- a/src/main/java/edu/ohio/ais/rundeck/HttpWorkflowNodeStepPlugin.java +++ b/src/main/java/edu/ohio/ais/rundeck/HttpWorkflowNodeStepPlugin.java @@ -64,18 +64,23 @@ public void executeNodeStep(PluginStepContext context, Map confi String headers = configuration.containsKey("headers") ? configuration.get("headers").toString() : null; String body = configuration.containsKey("body") ? configuration.get("body").toString() : null; + log.log(5, "remoteUrl: " + remoteUrl); + log.log(5, "method: " + method); + log.log(5, "headers: " + headers); + log.log(5, "timeout: " + timeout); + if(remoteUrl == null || method == null) { throw new NodeStepException("Remote URL and Method are required.", StepFailureReason.ConfigurationFailure, entry.getNodename()); } //Use options in remote URL if (null != remoteUrl && remoteUrl.contains("${")) { - remoteUrl = DataContextUtils.replaceDataReferences(remoteUrl, context.getDataContext()); + remoteUrl = DataContextUtils.replaceDataReferencesInString(remoteUrl, context.getDataContextObject()); } //Use options in body if (null != body && body.contains("${")) { - body = DataContextUtils.replaceDataReferences(body, context.getDataContext()); + body = DataContextUtils.replaceDataReferencesInString(body, context.getDataContextObject()); } HttpBuilder builder = new HttpBuilder(); @@ -98,7 +103,7 @@ public void executeNodeStep(PluginStepContext context, Map confi try { authHeader = builder.getAuthHeader(context, configuration); } catch (StepException e) { - throw new NodeStepException("Remote URL and Method are required.", e.getFailureReason(), entry.getNodename()); + throw new NodeStepException(e.getMessage(), e.getFailureReason(), entry.getNodename()); } if(authHeader != null) { @@ -125,7 +130,7 @@ public void executeNodeStep(PluginStepContext context, Map confi try { builder.doRequest(configuration, request.build(), 1); } catch (StepException e) { - throw new NodeStepException("Remote URL and Method are required.", e.getFailureReason(), entry.getNodename()); + throw new NodeStepException(e.getMessage(), e.getFailureReason(), entry.getNodename()); } }