diff options
Diffstat (limited to 'appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap')
-rw-r--r-- | appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java index fafe3deb1..ace39ee9c 100644 --- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java +++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java @@ -6,6 +6,8 @@ * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= + * Modifications Copyright (C) 2019 IBM + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -476,12 +478,14 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { private AnsibleResult postExecRequest(String agentUrl, String payload, String user, String password, SvcLogicContext ctx) { - AnsibleResult testResult; + AnsibleResult testResult = null; ConnectionBuilder httpClient = getHttpConn(defaultSocketTimeout, ""); if (!testMode) { + if(httpClient!=null) { httpClient.setHttpContext(user, password); testResult = httpClient.post(agentUrl, payload); httpClient.close(); + } } else { testResult = testServer.Post(agentUrl, payload); } @@ -509,9 +513,11 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { logger.info("Querying ansible GetResult URL = " + agentUrl); if (!testMode) { + if(httpClient!=null) { httpClient.setHttpContext(user, password); testResult = httpClient.get(agentUrl); httpClient.close(); + } } else { testResult = testServer.Get(agentUrl); } |