Skip to content

[BUG] Filter option for napalm.junos_rpc get_config not working after upgrading from 3004 to 3006.5 onedir #65867

Closed

Description

@ntt-raraujo

Description
After upgrading from salt 3004 to 3006.5 onedir I'm unable to apply filter using napalm.junos_rpc get_config

Please be as specific as possible and give set-up details.

  • on-prem machine
  • [X ] 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
  • classic packaging
  • [X ] onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
On salt 3004 I was able to use this command:

salt 'foo-bar-01' napalm.junos_rpc get_config filter='<configuration><security><address-book></address-book></security></configuration>'

On salt salt 3006.5 I got this error:

salt 'foo-bar-01' napalm.junos_rpc get_config filter='<configuration><security><address-book></address-book></security></configuration>'

foo-bar-01:
   The minion function caused an exception: Traceback (most recent call last):
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/junos.py", line 373, in rpc
       reply = getattr(conn.rpc, cmd.replace("-", "_"))(filter_reply, options=op)
     File "/opt/saltstack/salt/extras-3.10/jnpr/junos/rpcmeta.py", line 117, in get_config
       rpc = E("get-configuration", options)
     File "src/lxml/builder.py", line 222, in lxml.builder.ElementMaker.__call__
     File "src/lxml/builder.py", line 186, in lxml.builder.ElementMaker.__init__.add_dict
   KeyError: <class 'bool'>

   During handling of the above exception, another exception occurred:

   Traceback (most recent call last):
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/metaproxy/proxy.py", line 485, in thread_return
       return_data = minion_instance.executors[fname](
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
       ret = self.loader.run(run_func, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
       return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
       return _func_or_method(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
       return func(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
       ret = self.loader.run(run_func, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
       return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
       return _func_or_method(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/napalm.py", line 502, in func_wrapper
       ret = func(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/napalm_mod.py", line 824, in junos_rpc
       rpc_ret = __salt__["junos.rpc"](cmd=cmd, dest=dest, format=format, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
       ret = self.loader.run(run_func, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
       return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
       return _func_or_method(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/junos.py", line 169, in wrapper
       return function(*args, **kwargs)
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/junos.py", line 377, in rpc
       _restart_connection()
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/junos.py", line 234, in _restart_connection
       __proxy__["junos.shutdown"](__opts__)  # safely close connection
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 78, in __getitem__
       return self.value()[item]
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 349, in __getitem__
       super().__getitem__(item)  # try to get the item from the dictionary
     File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/lazy.py", line 107, in __getitem__
       return self._dict[key]
   KeyError: 'junos.shutdown'
ERROR: Minions returned with non-zero exit code

Expected behavior
The device configuration filtered as specified in the command

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.5

Python Version:
        Python: 3.10.13 (main, Nov 15 2023, 04:34:27) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.14.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: oracle 8.9
        locale: utf-8
       machine: x86_64
       release: 5.4.17-2136.326.6.el8uek.x86_64
        system: Linux
       version: Oracle Linux Server 8.9

Additional context

Both salt-master and proxy are using the same version
salt 'foo-bar-01' napalm.junos_rpc get_config (without filter) works fine.

Activity

  1. added
    bug
    on Jan 15, 2024
  2. sharonsa commented on Jan 9, 2026

    @sharonsa

    Had the same issue,
    It happened because junos.py convert __kwarg__ to --kwarg-- and It brake lxml, in XML a tag can't start with a '-'
    I solved it by removing the 'kwarg=true' KV in a function that wrap junos

    This is the code I added-

     for pub_arg in kwargs.get('__pub_arg', []):
        if isinstance(pub_arg, dict):
            pub_arg.pop('__kwarg__', None)
    
  3. dwoz commented on Oct 16, 2026

    @dwoz
    Contributor

    This was fixed in v3006.28 and v3007.15. If you can still reproduce it on either release, please comment and we'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions