saltstack / pepper

A library and stand-alone CLI tools to access a salt-api instance
Other
246 stars 123 forks source link

pepper -v and pepper -H don't display anything #31

Open arthurzenika opened 9 years ago

arthurzenika commented 9 years ago

The --verbose and --debug-http don't display anything.

I've tried adding some logger.debug statements which don't change anything.

Adding some prints are displayed.

            logger.debug('Sending ', postdata)

would be useful.

arthurzenika commented 9 years ago
        logger.setLevel(max(logging.ERROR - (self.options.verbose * 10), 1))

seem a bit weird. Could we adopt the same convention as for salt with --log-level all (all|debug|info|warn) etc.

whiteinge commented 9 years ago

I can't reproduce this. What version are you on? What is the full command you're running? What is the expected vs. actual output?

% pepper --debug-http -u http://localhost:8000 '*' test.ping
send: 'POST /login HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 63\r\nConnection: close\r\nAccept: application/json\r\nUser-Agent: Python-urllib/2.7\r\nHost: localhost:8000\r\nX-Requested-With: XMLHttpRequest\r\nContent-Type: application/json\r\n\r\n{"username": "saltdev", "password": "saltdev", "eauth": "auto"}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Length: 198
header: Access-Control-Expose-Headers: GET, POST
header: Vary: Accept-Encoding
header: Server: CherryPy/3.2.4
header: Allow: GET, HEAD, POST
header: Access-Control-Allow-Credentials: true
header: Date: Wed, 24 Jun 2015 19:30:14 GMT
header: Access-Control-Allow-Origin: *
header: X-Auth-Token: 0da8ccc7a05de1389b50364d762f7c96fa982365
header: Content-Type: application/json
header: Set-Cookie: session_id=0da8ccc7a05de1389b50364d762f7c96fa982365; expires=Thu, 25 Jun 2015 05:30:14 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: 0da8ccc7a05de1389b50364d762f7c96fa982365\r\nHost: localhost:8000\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: 107
header: Access-Control-Expose-Headers: GET, POST
header: Access-Control-Allow-Credentials: true
header: Vary: Accept-Encoding
header: Server: CherryPy/3.2.4
header: Allow: GET, HEAD, POST
header: Cache-Control: private
header: Date: Wed, 24 Jun 2015 19:30:14 GMT
header: Access-Control-Allow-Origin: *
header: Content-Type: application/json
header: Set-Cookie: session_id=0da8ccc7a05de1389b50364d762f7c96fa982365; expires=Thu, 25 Jun 2015 05:30:14 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: 0da8ccc7a05de1389b50364d762f7c96fa982365\r\nHost: localhost:8000\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": "20150624133014974350", "client": "runner"}]'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Length: 29
header: Access-Control-Expose-Headers: GET, POST
header: Access-Control-Allow-Credentials: true
header: Vary: Accept-Encoding
header: Server: CherryPy/3.2.4
header: Allow: GET, HEAD, POST
header: Cache-Control: private
header: Date: Wed, 24 Jun 2015 19:30:18 GMT
header: Access-Control-Allow-Origin: *
header: Content-Type: application/json
header: Set-Cookie: session_id=0da8ccc7a05de1389b50364d762f7c96fa982365; expires=Thu, 25 Jun 2015 05:30:18 GMT; Path=/
header: Connection: close
{
    "jerry": true
}
arthurzenika commented 9 years ago
$ pepper --version
0.2.0.dev37

I don't have any of the header/send/reply information. Looks nice, I hope we can get it work.

whiteinge commented 9 years ago

That version number looks odd. Related to #39 I'll bet.

rgeyer commented 7 years ago

I am experiencing the same issue. Using v0.4.1. I get the output of the command, but no debug/http data.

root@53ac749c6d63:/# pepper --version
0.4.1
root@53ac749c6d63:/# pepper -H '*' test.ping
{
    "return": [
        {
            "mongodb-backup-generic-test-i-00a2e54a978f64d21": true,
            "mongodb-generic-test-i-001c928a68509fae0": true,
            "mongodb-generic-test-i-03ca19e8101889f54": true,
            "salt-master": true
        }
    ]
}
root@53ac749c6d63:/# pepper -H '*' test.ping 2>&1
{
    "return": [
        {
            "mongodb-backup-generic-test-i-00a2e54a978f64d21": true,
            "mongodb-generic-test-i-001c928a68509fae0": true,
            "mongodb-generic-test-i-03ca19e8101889f54": true,
            "salt-master": true
        }
    ]
}
whiteinge commented 7 years ago

I believe this was fixed on the develop branch. Please try on the newly cut 0.5.0 release.

ezh commented 6 years ago

Maybe it is related to #138

gtmanfred commented 6 years ago

@rgeyer @arthurlogilab can yall check if the new version has fixed this issue?

Thanks, Daniel

rgeyer commented 6 years ago

Holy resurrected issue batman!

Sadly, I no longer have access to a working saltstack so I can't confirm.

gtmanfred commented 6 years ago

Ok, thanks for responding!

kyrias commented 6 years ago

@gtmanfred I just tried it with pepper 0.7.1 from PyPI, and it doesn't work.

kyrias commented 6 years ago

And more specifically, it's running under Python 3.6.

gtmanfred commented 6 years ago

sounds good, i will take a closer look when I have time.