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

Issue with auth to SaltStack API

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hello,

      When try connect to Salt API, I receive next error:

      Client error : Auth Error: net.sf.json.JSONException: JSONObject["return"] is not a JSONArray.
      
      {"Error": "java.io.IOException: Server returned HTTP response code: 400 for URL: http://salt.example.com:8000/login
      

      In master logs:

      # tail -f /var/log/salt/master 
      2015-09-28 11:28:45,306 [tornado.access   ][WARNING ][13082] 400 POST /login (192.168.10.50) 0.36ms
      

      But when I make request via curl, it works properly:

      $ curl -sS http://salt.example.com:8000/login -H 'Accept: application/x-yaml' -d username='jenkins' -d password='jenkins' -d eauth='pam'                                  
      *   Trying 192.168.10.50...
      * Connected to salt.example.com (192.168.10.50) port 8000 (#0)
      > POST /login HTTP/1.1
      > Host: salt.example.com:8000
      > User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0
      > Referer: 
      > Accept: application/x-yaml
      > Content-Length: 54
      > Content-Type: application/x-www-form-urlencoded
      > 
      * upload completely sent off: 54 out of 54 bytes
      < HTTP/1.1 200 OK
      < Date: Mon, 28 Sep 2015 10:52:46 GMT
      < Content-Length: 186
      < Content-Type: application/x-yaml
      < Server: TornadoServer/4.2.1
      < 
      return:
      - eauth: pam
        expire: 1443480766.019127
        perms: [test.*, pkg.*, cmd.*, state.*, '@runner']
        start: 1443437566.019126
        token: 8ad1cef834ee9df1a2eaff300c98a42c
        user: jenkins
      * Connection #0 to host salt.example.com left intact
      

      Versions of salt-master and salt-api:

      # salt-master --version
      salt-master 2015.5.3 (Lithium)
      # salt-api --version                                                                                                                                                                  
      salt-api 2015.5.3
      

      Also attached screenshot with detail information.

      Please fix this.

      Thank you!

      P.S. Looks like the similar issue on github (https://github.com/saltstack/salt/issues/18304), but for outdated version

        Attachments

          Activity

          Hide
          mchugh19 Christian McHugh added a comment -

          It appears you are using the tornado module, while the salt plugin was written to talk to the cherryPy api.

          The tornado api provides access to salt's eventbus via a websocket:
          https://salt-api.readthedocs.org/en/latest/ref/netapis/all/saltapi.netapi.rest_tornado.html

          While the cherry py module provides a rest api.
          https://salt-api.readthedocs.org/en/latest/ref/netapis/all/saltapi.netapi.rest_cherrypy.html

          Please try the cherrypy module and see if you still have problems.

          Show
          mchugh19 Christian McHugh added a comment - It appears you are using the tornado module, while the salt plugin was written to talk to the cherryPy api. The tornado api provides access to salt's eventbus via a websocket: https://salt-api.readthedocs.org/en/latest/ref/netapis/all/saltapi.netapi.rest_tornado.html While the cherry py module provides a rest api. https://salt-api.readthedocs.org/en/latest/ref/netapis/all/saltapi.netapi.rest_cherrypy.html Please try the cherrypy module and see if you still have problems.
          Hide
          dslupytskyi Dmytro Slupytskyi added a comment -

          I changed tornado to cherrypy and it works.

          Thank you!

          Show
          dslupytskyi Dmytro Slupytskyi added a comment - I changed tornado to cherrypy and it works. Thank you!

            People

            Assignee:
            mchugh19 Christian McHugh
            Reporter:
            dslupytskyi Dmytro Slupytskyi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: