Git Product home page Git Product logo

Comments (30)

whiteinge avatar whiteinge commented on September 14, 2024

Pepper is only tested against the rest_cherrypy netapi module. There are some community members who have played with it against Saltnado to varying success but rest_cherrypy is still the only development target. So it should be working for you.

  • What version of pepper?
  • What's the full command you're running?
  • What are the HTTP request/response headers that you see (-H flag)?

from pepper.

kottenator avatar kottenator commented on September 14, 2024

I use pepper==0.3.5 (installed from PyPI)

The full command I run: pepper -c pepper.conf -H '*' disk.usage

The output (with HTTP headers):

send: 'POST /login HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 61\r\nConnection: close\r\nAccept: application/json\r\nUser-Agent: Python-urllib/2.7\r\nHost: my-salt-apli-server:12345\r\nX-Requested-With: XMLHttpRequest\r\nContent-Type: application/json\r\n\r\n{"username": "my-user", "password": "my-password", "eauth": "pam"}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Length: 174
header: Access-Control-Expose-Headers: GET, POST
header: Vary: Accept-Encoding
header: Server: CherryPy/3.7.0
header: Allow: GET, HEAD, POST
header: Access-Control-Allow-Credentials: true
header: Date: Wed, 01 Jul 2015 14:50:32 GMT
header: Access-Control-Allow-Origin: *
header: X-Auth-Token: e3571c45847528c7588491494260a336cc0023fa
header: Content-Type: application/json
header: Set-Cookie: session_id=e3571c45847528c7588491494260a336cc0023fa; expires=Thu, 02 Jul 2015 00:50:32 GMT; Path=/
header: Connection: close
send: 'POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 80\r\nConnection: close\r\nAccept: application/json\r\nX-Auth-Token: e3571c45847528c7588491494260a336cc0023fa\r\nHost: my-salt-apli-server:12345\r\nX-Requested-With: XMLHttpRequest\r\nUser-Agent: Python-urllib/2.7\r\nContent-Type: application/json\r\n\r\n[{"fun": "test.ping", "client": "local_async", "expr_form": "glob", "tgt": "*"}]'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Length: 78
header: Access-Control-Expose-Headers: GET, POST
header: Access-Control-Allow-Credentials: true
header: Vary: Accept-Encoding
header: Server: CherryPy/3.7.0
header: Allow: GET, HEAD, POST
header: Cache-Control: private
header: Date: Wed, 01 Jul 2015 14:50:32 GMT
header: Access-Control-Allow-Origin: *
header: Content-Type: application/json
header: Set-Cookie: session_id=e3571c45847528c7588491494260a336cc0023fa; expires=Thu, 02 Jul 2015 00:50:32 GMT; Path=/
header: Connection: close
send: 'POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 79\r\nConnection: close\r\nAccept: application/json\r\nX-Auth-Token: e3571c45847528c7588491494260a336cc0023fa\r\nHost: my-salt-apli-server:12345\r\nX-Requested-With: XMLHttpRequest\r\nUser-Agent: Python-urllib/2.7\r\nContent-Type: application/json\r\n\r\n[{"fun": "jobs.lookup_jid", "jid": "20150701105032386888", "client": "runner"}]'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: Content-Length: 753
header: Access-Control-Expose-Headers: GET, POST
header: Access-Control-Allow-Credentials: true
header: Vary: Accept-Encoding
header: Server: CherryPy/3.7.0
header: Allow: GET, HEAD, POST
header: Cache-Control: private
header: Date: Wed, 01 Jul 2015 14:50:35 GMT
header: Access-Control-Allow-Origin: *
header: Content-Type: text/html;charset=utf-8
header: Set-Cookie: session_id=e3571c45847528c7588491494260a336cc0023fa; expires=Thu, 02 Jul 2015 00:50:35 GMT; Path=/
header: Connection: close
Pepper error: Authentication denied

And in your code, it breaks on salt-pepper/cli.py:237:

nodesRet = api.lookup_jid(nodesJid)

BTW, when I do the following, it works perfect for me:

import pepper

api = pepper.Pepper(url)
api.login(user, pwd, 'pam')
res = api.local(tgt, cmd)
print(json.dumps(res['return'][0], indent=4))

So why do you need this async stuff? And why do you execute test.ping each time before actual command? It looks too complex...

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

You're right that test.ping should not be in there.

I can reproduce what you're seeing. Looks like there's a problem with the -c flag. You can use the -u, -a, --username, and --password flags as a workaround.

This code to look for config/envvar/arguments needs to be better centralized so they don't step on each other. A test or two would really help as well.

Thanks for filing this! We'll get it fixed.

from pepper.

kottenator avatar kottenator commented on September 14, 2024

I tried next:

pepper --saltapi-url=my-salt-api-server:12345 --eauth=pam --username=my-user --password=my-password -H '*' disk.usage

But it gives the same error

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

from pepper.

kottenator avatar kottenator commented on September 14, 2024

I'd gladly contribute, but I'm too busy right now :(
I can provide any additional info if needed (e.g. master/minion configs and master/api logs)

from pepper.

kottenator avatar kottenator commented on September 14, 2024

@meggiebot - what does [Triangle] tag mean?

from pepper.

meggiebot avatar meggiebot commented on September 14, 2024

@kottenator - We're working on triaging issues for our upcoming release so we can get them into sprints, this tag helps us sort issues that need to be assigned out.

from pepper.

kottenator avatar kottenator commented on September 14, 2024

Got it, thanks!

from pepper.

meggiebot avatar meggiebot commented on September 14, 2024

@techhat - We talked about this issue today and though we're still going to try to get it in, it's not a blocker for Beryllium since it's separate. We could release this at any time.

from pepper.

kottenator avatar kottenator commented on September 14, 2024

Do you need my assistance to help you reproduce the bug?

from pepper.

meggiebot avatar meggiebot commented on September 14, 2024

Not sure, @techhat is the one actually working on this.

from pepper.

techhat avatar techhat commented on September 14, 2024

@kottenator, yes, I have been unable to reproduce so far. Which version of Salt are you running?

from pepper.

techhat avatar techhat commented on September 14, 2024

@kottenator, version 0.3.6 was released about a week ago. I wonder if this got fixed between the time you reported the issue and the release of the new version.

from pepper.

kottenator avatar kottenator commented on September 14, 2024

I tried pepper==0.3.6 and it still doesn't work for me... I use:

  • pepper==0.3.6
  • salt==2015.5.3

More versions from salt --versions-report

           Salt: 2015.5.3
         Python: 2.7.10 (default, Jun 22 2015, 12:12:22)
         Jinja2: 2.7.3
       M2Crypto: 0.22
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.11
          ioflo: Not Installed
          PyZMQ: 14.7.0
           RAET: Not Installed
            ZMQ: 4.1.2
           Mako: Not Installed
        Tornado: Not Installed

Output logs:

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

from pepper.

techhat avatar techhat commented on September 14, 2024

Thanks for the info @kottenator, I'll get testing with those versions right away.

@whiteinge, tbh, I didn't even know about the saltdev stuff.

from pepper.

techhat avatar techhat commented on September 14, 2024

@kottenator still can't reproduce. Can you look in /var/cache/salt/master/tokens/ and see if a file exists named after the value of the session_id in your pepper output? It looks like it authenticates okay, but doesn't remember the token.

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

from pepper.

techhat avatar techhat commented on September 14, 2024

My bad @whiteinge. Is the salt-api token cached anywhere outside of RAM?

from pepper.

kottenator avatar kottenator commented on September 14, 2024

I've checked: there is no 4c133a... token in my /var/cache/salt/master/tokens

from pepper.

kottenator avatar kottenator commented on September 14, 2024

BTW, I've installed salt into a local folder, not globally. So everything (configs, logs, cache) is inside it

from pepper.

techhat avatar techhat commented on September 14, 2024

Good to know, thanks @kottenator.

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

@kottenator what does your external_auth config look like?

from pepper.

kottenator avatar kottenator commented on September 14, 2024
external_auth:
  pam:
    myuser:
      - .*

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

Thanks for the quick answer. I see what's going on. Should have a fix in shortly.

from pepper.

kottenator avatar kottenator commented on September 14, 2024

Thanks for digging it ;)

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

@kottenator thanks for your -H paste above. There's a second HTTP request there which is trying to run the jobs.list_jobs function. So although your disk.usage call succeeds you see the error for the second command. The above pull request fixes the default behavior to not have that side-effect and only run the command you specify. I think that should do it but let me know if you run into any trouble!

from pepper.

kottenator avatar kottenator commented on September 14, 2024

Thank you for fixing this bug! Could you, please, release a new version on PyPI so I could use the fixed version?

from pepper.

whiteinge avatar whiteinge commented on September 14, 2024

Pushed!

https://github.com/saltstack/pepper/releases/tag/0.3.7

from pepper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.