Skip to content

[BUG] Deltaproxy and napalm.junos_cli #63599

@n-holmstedt

Description

@n-holmstedt

Description
We've encountered some issues with using the junos execution module with the junos napalm proxy.

There seem to be some kind of autovivification-issue, or similar, affecting the timeout-wrapper in the junos execution module. The wrapper expects the kwarg "dev_timeout" to exist and be defined, when in reality it is 'None' when not specifying it.

salt hostname napalm.junos_cli 'show version' format=xml
hostname:
    Passed invalid arguments to napalm.junos_cli: '>' not supported between instances of 'int' and 'NoneType'
salt hostname napalm.junos_cli 'show version' format=xml dev_timeout=30
hostname:
    <works>

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

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): 1x Master container, 1x Deltaproxy container.
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
One master running in docker container.
One delta-proxy running in docker container.
One Juniper MX204

Traceback from the host running the delta proxy:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/salt/metaproxy/deltaproxy.py", line 669, in thread_return
    opts, data, func, args, kwargs
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1228, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1243, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/executors/direct_call.py", line 10, in execute
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1228, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1243, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/utils/napalm.py", line 512, in func_wrapper
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/napalm_mod.py", line 980, in junos_cli
    command, format=format, dev_timeout=dev_timeout, dest=dest, **kwargs
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1228, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/loader/lazy.py", line 1243, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/junos.py", line 156, in wrapper
    ldev_timeout = max(kwargs.pop("dev_timeout", 0), kwargs.pop("timeout", 0))
TypeError: '>' not supported between instances of 'int' and 'NoneType'

Expected behavior
Expecting the junos execution modul not to throw a TypeError when looking at dev_timeout.

Versions Report

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

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.0
       libgit2: 1.1.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.17
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: 1.6.1
        Python: 3.7.13 (default, Apr 20 2022, 03:16:50)
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 18.0.1
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: alpine 3.14.6
        locale: UTF-8
       machine: x86_64
       release: 4.18.0-372.9.1.el8.x86_64
        system: Linux
       version: Alpine Linux 3.14.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Delta-Proxybugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thisneeds-triage

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions