napalm-automation / napalm-ios

Apache License 2.0
32 stars 40 forks source link

Missing end in "merge_config.txt" causes the error "!Error: cfgdiff returned error 5" #195

Closed bdlamprecht closed 6 years ago

bdlamprecht commented 6 years ago

Description of Issue/Question

Missing end in merge_config.txt on IOS device causes the following error to occur:

!Error: cfgdiff returned error 5

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

Setup

Ubuntu 16.04.3

napalm-ios version

$ pip freeze | grep napalm-ios
napalm-ios==0.7.0

Steps to Reproduce the Issue

Using the automatically generated files merge_config.txt and candidate_config.txt, the following command was run on the device:

router# show archive config incremental-diffs disk0:merge_config.txt ignorecase
!List of Commands:
Error: received error code 5 when looking for missing lines
!Error: cfgdiff returned error 5

When the merge_config.txt was modified manually to include a final end, the error no longer occurs:

router# show archive config incremental-diffs disk0:merge_config.txt ignorecase
!List of Commands:
end
!No changes were found

In short, this is to request that in napalm_install_config, a final end is added to the merge_config.txt and some type of error checking be done to ignore the "end" in the output above.

FYI, I noticed that candidate_config.txt correctly DOES have a final end in the last line of the file.

ktbyers commented 6 years ago

Fix here: https://github.com/napalm-automation/napalm-ios/pull/207

Note, the fix is just to print a message indicating what the problem is. Basically, I think it is a mistake for napalm-ios to modify the config file in your file system (on your central server). It is better to direct the user to what the problem is and then they can make the necessary modification.

Thanks for figuring out what was causing this!