clover1983 That was the change I tried initially, but 'credentials' takes a list while 'credential' takes an int so tower throws a type error. That's jist of the issue though - Tower 3.6 removed the 'credential' field which is what the plugin sends.
Here's the smallest change I could make that seems to work for now. There's already logic in place to account for this, it just needs to be used. Note this will break compatibility with old versions of the API that don't support 'credentials' field. We built this code and are using it for now as a stop-gap since Tower 3.6 supports only 'credentials':
https://github.com/jenkinsci/ansible-tower-plugin/compare/master...kfattig:master
johnwestcottiv I believe this code segment needs to be revisited. The comment explains the logic, but I believe it's flawed. Tower only accepts 1 machine credential currently, so the 'if' statement is never entered. Since the accepted fields change based on the API version - maybe that should be taken into account here instead?
Happy to contribute or test as necessary, just didn't feel confident submitting a full PR without more information & testing.
Hi ALL,
I find the issue,
issue is in the source code: ../ansible-tower-plugin/src/main/java/org/jenkinsci/plugins/ansible_tower/util/TowerConnector.java
Line:517
Before Change
// We need to pass individual fields
if(credentials.get("machine").size() > 0) { postBody.put("credential", credentials.get("machine").get(0)); }
if(credentials.get("vault").size() > 0) { postBody.put("vault_credential", credentials.get("vault").get(0)); }
After Change:
// We need to pass individual fields
if(credentials.get("machine").size() > 0) { postBody.put("credentials", credentials.get("machine")); }
if(credentials.get("vault").size() > 0) { postBody.put("vault_credential", credentials.get("vault")); }
Then it should works.
Thank you.