[BUG] Unable to add users on junos via napalm
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Then applying netusers state as described there https://docs.saltproject.io/en/latest/ref/states/all/salt.states.netusers.html got following error:
File "/usr/lib/python3.6/site-packages/salt/state.py", line 2180, in call
*cdata["args"], **cdata["kwargs"]
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
return callable(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1249, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/states/netusers.py", line 327, in managed
expected_users = _expand_users(users, defaults)
File "/usr/lib/python3.6/site-packages/salt/states/netusers.py", line 74, in _expand_users
expected_users.update(device_users)
AttributeError: 'NoneType' object has no attribute 'update'
Also if i try set users thru salt.modules.napalm_users.set_users got next error
sudo salt 'router1' users.set_users '{"micrea":{}}'
router1:
----------
comment:
Local file source set_users does not exist
out:
None
result:
False
ERROR: Minions returned with non-zero exit code
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Juniper EX-3400
Please be as specific as possible and give set-up details.
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
Steps to Reproduce the behavior
users.sls
junos-users:
netusers.managed:
- users:
admin:
level: 15
password: $1$knmhgPPv$g8745biu4rb.Zf.IT.F/U1
sshkeys: []
restricted:
level: 1
password: $1$j34j5k4b$4d5SVjTiz1l.Zf.IT.F/K7
/srv/pillar/juniper.sls
proxy:
proxytype: napalm
driver: junos
ip: xx.xx.xx.xx
username: user
password: passwd
Expected behavior
Add/remove users from juniper config
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: 1.11.5
cherrypy: unknown
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.14
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Apr 12 2022, 06:55:39)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 19.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: rocky 8.5 Green Obsidian
locale: UTF-8
machine: x86_64
release: 4.18.0-348.7.1.el8_5.x86_64
system: Linux
version: Rocky Linux 8.5 Green Obsidian
Additional context
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with salt/states/netusers.py, especially _expand_users and managed, then inspect the salt.modules.napalm_users.set_users entry point using the supplied users.sls and Junos proxy configuration. Reproduce the NoneType and local-file-source errors and trace how the Junos driver handles the requested users. Done means the state can add and remove the specified Junos users without either error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100