Troubleshooting Connection Errors When Using Salt to Manage Devices Running Junos OS
Problem
Description
After starting the proxy minion process
for a device running Junos OS and accepting the key on the Salt master,
the Junos proxy (for Salt) fails to connect to the device, and the
proxy log file on the proxy minion server includes an error regarding
missing init()
or shutdown()
functions. For example:
saltuser@salt-master:~$ sudo salt 'router1' test.ping router1: Minion did not return. [No response]
saltuser@minion:~/.ssh$ sudo cat /var/log/salt/proxy ... KeyError: 'junos.initialized' 2019-06-21 22:23:07,044 [salt.minion :3414][ERROR ][31048] Proxymodule junos is missing an init() or a shutdown() or both. Check your proxymodule. Salt-proxy aborted. 2019-06-21 22:23:07,044 [salt.cli.daemons :533 ][ERROR ][31048] Proxymodule junos is missing an init() or a shutdown() or both. Check your proxymodule. Salt-proxy aborted.
Cause
The Junos proxy minion server must have the Juniper Network’s
Junos PyEZ library (junos-eznc
) and jxmlease
Python module as well as the yamlordereddictloader
Python module installed on the
server in order to use Salt to manage devices running Junos OS.
Solution
Install Junos PyEZ and the jxmlease
and yamlordereddictloader
Python modules
on the Junos proxy minion server under the same version of Python
that Salt is installed. For example:
saltuser@minion:~$ sudo pip3 install junos-eznc jxmlease yamlordereddictloader
After the dependencies are installed, start the proxy minion process for that device on the proxy minion server and accept the new Salt key on the Salt master.
saltuser@minion:~$ sudo salt-proxy --proxyid=router1 -d
saltuser@salt-master:~$ sudo salt-key -a router1 The following keys are going to be accepted: Unaccepted Keys: router1 Proceed? [n/Y] y Key for minion router1 accepted.