Saturday, January 26, 2019

Salt/Napalm state.apply module getting LockError but user is Super-User

is it possible this could be related to a bug? i am getting the LockError when attempting to run state.apply but the user it is referring to is a super user

/srv/pillar % sudo salt sj1e2 state.apply DrainSJ1SG1secondary

sj1e2:

----------

ID: Drain SJ1SG1 secondary

Function: netconfig.managed

Result: False

Comment: Cannot execute "load_merge_candidate" on *.*.*.* as SALT. Reason: LockError(severity: error, bad_element: lock-configuration, message: permission denied)!

Configuration discarded.

Started: 15:09:34.276672

Duration: 1146.165 ms

Changes:

----------

diff:

Summary for sj1e2

------------

Succeeded: 0 (changed=1)

Failed: 1

------------

Total states run: 1

Total run time: 1.146 s

ERROR: Minions returned with non-zero exit code

This is the juniper device config related to user SALT

set system login user SALT uid 2003

set system login user SALT class super-user

set system services netconf ssh

here is the sj1e2 (proxy-2.sls) and the Top.sls under /srv/pillar

proxy:

proxytype: napalm

driver: junos

host: *.*.*.*

username: SALT

password: ******

port: 830

base:

'sj1e2':

- proxy-2

When running -i dug with the state.apply command there are two things that stick out besides the LockError

State 'netconfig.managed' was not found in SLS 'DrainSJ1SG1secondary'
Reason: 'netconfig' __virtual__ returned False: "netconfig"" (/usr/lib/python2.7/dist-packages/salt/states/netconfig.pyc) cannot be loaded: NAPALM is not installed or not running in a (proxy) minion

but netconfig.managed is in DrainSJ1SG1secondary.sls here

DrainSJ1SG1secondary:
netconfig.managed:
- template_name: salt://DrainSJ1SG1secondary.conf

also napalm is installed on the minion and the master cut a lot of lines out

saltminion% pip install napalm
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: napalm in ./.local/lib/python2.7/site-packages (2.3.3)
Requirement already satisfied: asn1crypto>=0.21.0 in ./.local/lib/python2.7/site-packages (from cryptography>=1.5->paramiko>=1.15.2->junos-eznc>=2.1.5->napalm) (0.24.0)
[2019-01-26 18:18:43-0800] saltminion% salt-minion --version
salt-minion 2018.3.3 (Oxygen)

and above i posted the proxy-2.sls (sj1e2) which shows the proxytype as napalmproxy:

proxy:

proxytype: junos

host: ****

username: SALT

password:****

port: 830

which is is the /srv/pillar dir on the master along with the top.sls. also i could do the configure exclusive from the SALT user name on the device cli

SALT> configure exclusive
warning: uncommitted changes will be discarded on exit
Entering configuration mode

{master}[edit]
SALT#

i can run other modules fine but its state.apply that is specifically giving me issues, so connections to the device isnt a issue.



No comments:

Post a Comment