Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

optional_args are not forwarded correctly from CLI tools #209

Open
kderynski opened this issue Feb 13, 2017 · 0 comments
Open

optional_args are not forwarded correctly from CLI tools #209

kderynski opened this issue Feb 13, 2017 · 0 comments
Labels
Milestone

Comments

@kderynski
Copy link

kderynski commented Feb 13, 2017

I have noticed that there is an issue with optional_args forwarded from CLI based tools (cl_napalm_test and cl_napalm_configure). I have checked it against junos driver with fresh install of napalm version 0.23.0 (tested on macOS and ubuntu 16.04). All values from optional_args are forwarded from CLI as unicode and they are used directly in drivers. It causes an issue in case of basic port parameter. Drivers (junos and arista at least) are expecting integers, so variables should be casted in CLI tools code or in drivers code.

Example use of cli based tool:

cl_napalm_configure --user root --password Juniper --vendor junos --optional_args 'port=22' --strategy merge 192.168.50.6 merge_test.txt

and exception for this example:

Traceback (most recent call last):
  File "/usr/local/bin/cl_napalm_configure", line 9, in 
    load_entry_point('napalm-base==0.23.0', 'console_scripts', 'cl_napalm_configure')()
  File "/usr/local/lib/python2.7/dist-packages/napalm_base/clitools/cl_napalm_configure.py", line 59, in main
    args.optional_args, args.config_file, args.dry_run))
  File "/usr/local/lib/python2.7/dist-packages/napalm_base/clitools/cl_napalm_configure.py", line 32, in run
    with driver(hostname, user, password, optional_args=optional_args) as device:
  File "/usr/local/lib/python2.7/dist-packages/napalm_base/base.py", line 54, in __enter__
    self.__raise_clean_exception(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python2.7/dist-packages/napalm_base/base.py", line 82, in __raise_clean_exception
    raise exc_value
jnpr.junos.exception.ConnectError: ConnectError(host: 192.168.50.6, msg: getaddrinfo() argument 2 must be integer or string)

I am happy to fix this issue but I would like to discuss first where it should be fixed, CLI tools (probably the best way imho) or in drivers.

@mirceaulinic mirceaulinic added this to the APPROVED milestone Feb 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants