Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54341

Ansible Tower Plugin 0.9.0 not compatible with Tower 3.2.5

    • 0.9.1

      Jenkins: 2.121.3

      Ansible-Tower-Plugin: 0.9.0

      Ansible Tower: 3.2.5

       

      When configuring a Ansible Tower 3.2.5 connectivity with plugin version 0.9.0 it does not work (anymore?)

      Plugin is issuing a POST "/api/v2/authtoken/" and retrieving a token: {"token":"2878104c539b9dd3526cd07280f596441d7b9e02","expires":"2018-10-30T09:56:23.351Z"}

      Then Plugin is sending a GET Request "/api/v2/jobs/", but is sending the Header "Authorization: Bearer 2878104c539b9dd3526cd07280f596441d7b9e02" which will result in a 401 error {"detail":"Authentication credentials were not provided."}.

      Problem is the "Bearer" value in the Header (introduced with OAuth  support for Tower 3.3 ?). The correct request needs to send the Header as "Authorization: Token 2878104c539b9dd3526cd07280f596441d7b9e02", then the command is working (from curl).

      As a result, the plugin 0.9.0 is not working with Ansible Tower 3.2.5. I have currently no possibility to upgrade Ansible Tower to >= 3.3.

       

       

          [JENKINS-54341] Ansible Tower Plugin 0.9.0 not compatible with Tower 3.2.5

          Rainer Montag added a comment - - edited

          The method org.jenkinsci.plugins.ansible_tower.util.TowerVersion.is_greater_or_equal() in commit cc76e71bffafd5a64747a3fa703256afee12fc7a  (https://github.com/jenkinsci/ansible-tower-plugin/commit/cc76e71bffafd5a64747a3fa703256afee12fc7a) is broken:

          public static void main(String[] args) throws AnsibleTowerException {
                  TowerVersion v325 = new TowerVersion("3.2.5");
                  System.out.println(v325.is_greater_or_equal("3.3.0"));
               } 

          Returns "true"  As a result, the TowerConnector - which is perfoming the check will always use "Bearer" method and not the legacy "Token" method.

          Rainer Montag added a comment - - edited The method org.jenkinsci.plugins.ansible_tower.util.TowerVersion.is_greater_or_equal() in commit cc76e71bffafd5a64747a3fa703256afee12fc7a  ( https://github.com/jenkinsci/ansible-tower-plugin/commit/cc76e71bffafd5a64747a3fa703256afee12fc7a ) is broken: public static void main( String [] args) throws AnsibleTowerException { TowerVersion v325 = new TowerVersion( "3.2.5" ); System .out.println(v325.is_greater_or_equal( "3.3.0" )); } Returns "true"  As a result, the TowerConnector - which is perfoming the check will always use "Bearer" method and not the legacy "Token" method.

          Rainer Montag added a comment -

          To workaround for our usage with Tower 3.2.5 we reverted the plugin back to 0.8.7 in our Jenkins instance.

          Rainer Montag added a comment - To workaround for our usage with Tower 3.2.5 we reverted the plugin back to 0.8.7 in our Jenkins instance.

          John Westcott added a comment -

          Sorry for the delay, this issue should now be fixed in 0.9.1. Instead of using a version check to determine Token or Bearer we now using the same method as TowerCLI to better determine the correct course of action. If you find that 0.9.1 does not fix this issue please reopen the ticket.

          John Westcott added a comment - Sorry for the delay, this issue should now be fixed in 0.9.1. Instead of using a version check to determine Token or Bearer we now using the same method as TowerCLI to better determine the correct course of action. If you find that 0.9.1 does not fix this issue please reopen the ticket.

            johnwestcottiv John Westcott
            rmontag Rainer Montag
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: