Error importing from salt-master

Hello -
I’m getting the following error when I click “Import from Salt-Master” on my foreman server: "ERF12-4701 [ProxyAPI::ProxyException]: Unable to fetch Salt states list ([ProxyAPI::ProxyException]: ERF12-7301 [ProxyAPI::ProxyException]: Unable to fetch Salt environments list ([RestClient::NotAcceptable]: 406 "

Similar to this: Bug #23985: "406 Not Acceptable" when attempting to import salt states - Salt - Foreman

Expected outcome:
Salt States are imported correctly

Foreman and Proxy versions:
1.19.1

Foreman and Proxy plugin versions:
[root@blah-salt salt]# rpm -qa | grep foreman
foreman-proxy-1.19.1-1.el7.noarch
foreman-release-1.20.1-1.el7.noarch
foreman-debug-1.19.1-1.el7.noarch
[root@blah-salt salt]# rpm -qa | grep salt
salt-minion-2018.3.3-1.el7.noarch
salt-ssh-2018.3.3-1.el7.noarch
salt-master-2018.3.3-1.el7.noarch
salt-api-2018.3.3-1.el7.noarch
rubygem-smart_proxy_salt-2.1.9-1.el7.noarch
salt-2018.3.3-1.el7.noarch

Other relevant data:

Foreman logs:
2019-01-28T10:18:27 [W|app|0857e] ProxyAPI operation FAILED
| ProxyAPI::ProxyException: ERF12-4701 [ProxyAPI::ProxyException]: Unable to fetch Salt states list ([ProxyAPI::ProxyException]: ERF12-7301 [ProxyAPI::ProxyException]: Unable to fetch Salt environments list ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy http://blah-salt.blah.blah.edu:8000/salt/) for proxy http://blah-salt.blah.blah.edu:8000/salt/
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-10.1.0/app/lib/proxy_api/salt.rb:43:in `rescue in states_list’

Salt Version:
Salt: 2018.3.3

Dependency Versions:
cffi: Not Installed
cherrypy: 5.6.0
dateutil: 1.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
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.5.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: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

/etc/foreman-proxy/settings.d/salt.yml

:enabled: http
:autosign_file: /etc/salt/autosign.conf
:salt_command_user: root
:use_api: true
:api_url: http://blah-salt.blah.blah.edu:9191
:api_auth: pam
:api_username: saltapiuser
:api_password: ****

/etc/salt/foreman.yml

:proto: http
:host: foreman.blah.blah.edu
:port: 80
:username: admin
:password: *****
:timeout: 10
:salt: /usr/bin/salt
:upload_grains: true

Salt Master:
external_auth:
pam:
saltapiuser:
- .*
- ‘@runner

rest_cherrypy:
port: 9191
host: 127.0.0.1
disable_ssl: true

master_tops:
ext_nodes: /usr/bin/foreman-node

state_verbose: True

ext_pillar:

  • puppet: /usr/bin/foreman-node

file_roots:
base:
- /srv/salt

Hey sorry for the delay - I know I promised you an answer on IRC, but conferences got in the way :stuck_out_tongue:

So the thing that stands out to me is the 406 Not Acceptable from the Proxy. If you’re still struggling and haven’t already just burned it down, could you take a look at the proxy logs, ideally with debug enabled, and see what it’s complaining about? Thanks!

Hello -
Thanks for the reply! I did sort things out just recently - I meant to post back here, just hadn’t yet.

I think it boiled down to how I had my /etc/salt/master file setup, specifically, the rest_cherrypy: stanza
I changed host: from 127.0.0.1 to the fqdn and that seemed to work.

I was troubleshooting it, by using telnet to port 9191 and noticed it was working locally, but not remote. Which makes sense. Simple fix, but now I can import from the salt-master.

Thanks

Good to know, thanks! Hope it keeps on working :slight_smile: