Skip to content

Timeout value problem with napalm.junos_cli and sometimes RPC #58108

Closed as not planned

Description

@eosborne-vio

Description of Issue

When I run napalm.junos_cli commands, they have issues with a timeout not getting set. There are a couple variants of this and I'm not 100% sure they're related, but they look awfully close.

issue the first

It looks like there should be a timeout passed in for a cli command, and there isn't. I have tried setting -t <val> and --timeout=<val> both immediately after $RTR and at the endo of the command line and there's no difference.

salt@9bcd18b7855c:~$ salt $RTR napalm.junos_cli "show version"
cfr1.ix1.dfw:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/jnpr/junos/device.py", line 206, in timeout
        self._conn.timeout = int(value)
    TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/salt/metaproxy/proxy.py", line 480, in thread_return
        opts, data, func, args, kwargs
      File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/utils/napalm.py", line 515, in func_wrapper
        ret = func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/modules/napalm_mod.py", line 930, in junos_cli
        command, format=format, dev_timeout=dev_timeout, dest=dest, **kwargs
      File "/usr/lib/python3/dist-packages/salt/modules/junos.py", line 174, in wrapper
        conn.timeout = kwargs.pop("dev_timeout", None)
      File "/usr/local/lib/python3.6/dist-packages/jnpr/junos/device.py", line 209, in timeout
        "could not convert timeout value of %s to an " "integer" % (value)
    RuntimeError: could not convert timeout value of None to an integer
ERROR: Minions returned with non-zero exit code

issue the second

Although some direct `napalm.junos_rpc' commands work, like this one:

salt@9bcd18b7855c:~$ salt $RTR napalm.junos_rpc get-system-information
cfr1.ix1.dfw:
    ----------
    comment:
    out:
        ----------
        system-information:
            ----------
            hardware-model:
                mx10003
            host-name:
                cfr1.ix1.dfw
...

some of the more involved ones do not, and they have what looks like a similar timeout issue.
If I run the command salt $RTR net.cli "request vmhost snapshot" -t 120
the -t 120 timeout gets obeyed but there is an rpc timeout error:

salt@9bcd18b7855c:~$ salt $RTR net.cli "request vmhost snapshot" -t 120
cfr1.ix1.dfw:
    ----------
    comment:
    out:
        ----------
        request vmhost snapshot:
            invalid command: request vmhost snapshot: RpcTimeoutError(host: cfr1.ix1.dfw, cmd: command, timeout: 60)
    result:
        True

I have tried any number of --dev_timeout <val> and --dev_timeout=<val> and dev_timeout= parameters , at various places in the command line, and nothing I do makes this go away. Setting --dev-timeout to some value >60 always leaves me with the same error message, always displaying "timeout: 60". So whatever I'm trying to pass in isn't getting relayed down. One example:

salt@9bcd18b7855c:~$ time salt $RTR net.cli -t 120 "request vmhost snapshot" dev_timeout=5000
cfr1.ix1.dfw:
    ----------
    comment:
    out:
        ----------
        request vmhost snapshot:
            invalid command: request vmhost snapshot: RpcTimeoutError(host: cfr1.ix1.dfw, cmd: command, timeout: 60)
    result:
        True

real	1m1.384s
user	0m1.740s
sys	0m0.234s

Setup

I am running salt-master in one docker container and salt-proxy in another. All version 3001, freshly built.

Steps to Reproduce Issue

See above. I'm happy to run more tests, this is easy to reproduce.

Versions Report

Master and minion are build from the same container base:

salt@9bcd18b7855c:~$ salt --versions-report
Salt Version:
           Salt: 3001

Dependency Versions:
           cffi: 1.14.1
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
         Jinja2: 2.11.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.20
       pycrypto: 2.6.1
   pycryptodome: 3.4.7
         pygit2: Not Installed
         Python: 3.6.9 (default, Jul 17 2020, 12:50:27)
   python-gnupg: 0.4.1
         PyYAML: 5.3.1
          PyZMQ: 17.1.2
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: ubuntu 18.04 Bionic Beaver
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 5.3.0-1030-gcp
         system: Linux
        version: Ubuntu 18.04 Bionic Beaver

Activity

  1. changed the title [-]Timeout value problem with napalm.junos_cli[/-] [+]Timeout value problem with napalm.junos_cli and sometimes RPC[/+] on Jul 31, 2020
  2. cmcmarrow commented on Aug 3, 2020

    @cmcmarrow
    Contributor

    TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

  3. added
    severity-medium
    bug
    on Aug 3, 2020
  4. added this to the Approved milestone on Aug 3, 2020
  5. wasabi222 commented on Oct 16, 2020

    @wasabi222
    Contributor

    I just came across this. the correct argument is dev_timeout - see below:

    root@default-bento-debian-10:/srv/salt/_modules# salt junos napalm.junos_cli 'show chassis hardware'
    junos:
        The minion function caused an exception: Traceback (most recent call last):
          File "/usr/local/lib/python3.7/dist-packages/jnpr/junos/device.py", line 206, in timeout
            self._conn.timeout = int(value)
        TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "/usr/lib/python3/dist-packages/salt/metaproxy/proxy.py", line 480, in thread_return
            opts, data, func, args, kwargs
          File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
            return func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/salt/utils/napalm.py", line 515, in func_wrapper
            ret = func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/salt/modules/napalm_mod.py", line 930, in junos_cli
            command, format=format, dev_timeout=dev_timeout, dest=dest, **kwargs
          File "/usr/lib/python3/dist-packages/salt/modules/junos.py", line 177, in wrapper
            conn.timeout = kwargs.pop("dev_timeout", None)
          File "/usr/local/lib/python3.7/dist-packages/jnpr/junos/device.py", line 209, in timeout
            "could not convert timeout value of %s to an " "integer" % (value)
        RuntimeError: could not convert timeout value of None to an integer
    ERROR: Minions returned with non-zero exit code
    root@default-bento-debian-10:/srv/salt/_modules# salt junos napalm.junos_cli 'show chassis hardware' dev_timeout=30
    junos:
        ----------
        message:
            Hardware inventory:
            Item             Version  Part number  Serial number     Description
            Chassis                                VM5E2567B514
        out:
            True
    root@default-bento-debian-10:/srv/salt/_modules#
    

    This happens because the default argument for dev_timeout in the napalm.junos_cli function is None but it should be something sane like 60 instead. Line 931 in modules/napalm_mod.py:

    def junos_cli(command, format=None, dev_timeout=None, dest=None, **kwargs):
    

    should be:

    def junos_cli(command, format=None, dev_timeout=60, dest=None, **kwargs):
    
  6. dmurphy18 commented on Oct 16, 2020

    @dmurphy18
    Contributor

    Have the timeout issue for Junos fixed in native minions, waiting till after upcoming release to send in a PR post release

  7. eosborne-vio commented on Oct 19, 2020

    @eosborne-vio
    Author

    I just came across this. the correct argument is dev_timeout - see below:

    I tried dev_timeout and that didn't work for me, please see the bottom of my initial report. Here it is again on 3001.1:

    With just dev_timeout:

    salt@d6a2f7943936:~$ time salt cfr1.ke2.dfw net.cli 'request vmhost snapshot' dev_timeout=1800
    cfr1.ke2.dfw:
        Minion did not return. [No response]
        The minions may not have all finished running and any remaining minions will return upon completion. To look up the return data for this job later, run the following command:
    
        salt-run jobs.lookup_jid 20201019113042556833
    ERROR: Minions returned with non-zero exit code
    
    real	0m16.166s
    

    With both dev_timeoutand -t:

    salt@d6a2f7943936:~$ time salt cfr1.ke2.dfw net.cli 'request vmhost snapshot' dev_timeout=1800 -t 120
    cfr1.ke2.dfw:
        ----------
        comment:
            Cannot execute "cli" on cfr1.ke2.dfw as autovapor. Reason: RpcTimeoutError(host: cfr1.ke2.dfw, cmd: command, timeout: 60)!
        out:
            ----------
    ....
    ERROR: Minions returned with non-zero exit code
    
    real	1m1.141s
    user	0m1.331s
    sys	0m0.166s
    
  8. wasabi222 commented on Oct 19, 2020

    @wasabi222
    Contributor

    I was referring to your "issue the first" above - the RuntimeError: could not convert timeout value of None to an integer exception can be fixed by setting dev_timeout. The other two I'm not sure about.

  9. dwoz commented on Oct 15, 2026

    @dwoz
    Contributor

    Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.

    Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.

    If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.

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

    bugseverity-mediumstale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions