When I attempt to use my X-Auth-Token I get:
We don't serve your kind here
I am using salt-api and Tornado.
[root@foreman2 tmp]# curl -ski localhost:8000/login \
-H "Accept: application/json" \
-d username='myuser' \
-d password='somepassword' \
-d eauth='pam'
HTTP/1.1 200 OK
Date: Thu, 04 Apr 2019 08:58:03 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
Content-Length: 202
Server: TornadoServer/4.2.1{"return": [{"perms": [".*"], "start": 1554368283.173933, "token": > "61efbc206dccf0b77e123fab4363d01ea98fa4a82e8f0577aac1e0e80bb21103", "expire": > 1554411483.173934, "user": "myuser", "eauth": "pam"}]}[root@foreman2 tmp]#
[root@foreman2 tmp]#
[root@foreman2 tmp]#
[root@foreman2 tmp]#
[root@foreman2 tmp]# curl -sk http://localhost:8000/minions -H 'Accept: application/json' -H 'X-Auth- Token: 61efbc206dccf0b77e123fab4363d01ea98fa4a82e8f0577aac1e0e80bb21103' -d client='local' -d tgt='*' -d fun='test.ping'
We don't serve your kind here[root@foreman2 tmp]#
[root@foreman2 tmp]#
Salt Version:
Salt: 2019.2.0
Dependency Versions:
cffi: Not Installed
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-957.10.1.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core
salt-api debug shows:
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[WARNING ] 400 POST /minions (xxx.xx.xx.xx) 65.16ms
Thanks for the report.
@saltstack/team-core Can you take a look at this issue, I have not been able to replicate it.
Thanks.
I am a Windows tech and very new to Salt, so it is completely plausible that it is something very basic I am doing wrong.
If someone can show me a successful API call with a fiddler dump. I can attempt to recreate that.
Using Content-Type: application/json gets me:
POST http://xx.xxx.xxx.xx:8000/minions HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Auth-Token: c91f8b3e3d38a3ae007c63a253c99ff0876e205116d6630ddced5833a5101566
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.17134.590
Host: xx.xxx.xxx.xx:8000
Content-Length: 72{
"fun": "test.ping",
"tgt": "*",
"client": "local"
}
HTTP/1.1 400 Bad Request
Date: Fri, 05 Apr 2019 06:32:59 GMT
Access-Control-Allow-Origin: *
Content-Type: text/html; charset=UTF-8
Content-Length: 29
Server: TornadoServer/4.2.1We don't serve your kind here
Setting Content-Type: application/x-www-form-urlencoded gets me:
POST http://xx.xxx.xxx.xx:8000/minions HTTP/1.1
X-Auth-Token: c91f8b3e3d38a3ae007c63a253c99ff0876e205116d6630ddced5833a5101566
Accept: application/json
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.17134.590
Content-Type: application/x-www-form-urlencoded
Host: xx.xxx.xxx.xx:8000
Content-Length: 72
Connection: Keep-Alive{
"fun": "test.ping",
"tgt": "*",
"client": "local"
}
HTTP/1.1 200 OK
Date: Fri, 05 Apr 2019 06:38:21 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
Content-Length: 105
Server: TornadoServer/4.2.1{"return": ["Unexpected exception while handling request: run_job takes at least 2 arguments (0 given)"]}
Salt:2019.2.0
windows cygwin ssh
salt-ssh "S1" -r 'ls /' --- is ok
salt-api
curl
{"return": [{"S1": {"_stamp": "2019-04-09T07:29:57.142639", "retcode": 10, "stdout": "ERROR: Python version error. Recommendation(s) follow:\nInstall Python 2.6 / Python 3 Salt dependencies on the Salt SSH master \nto interact with Python 2.6 / Python 3 targets", "jid": "20190409152956136352", "stderr": "ERROR: Unable to locate appropriate python command\n", "id": "S1"}}]}
Switching to cherrypy from Tornado fixed it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Most helpful comment
Switching to cherrypy from Tornado fixed it.