napalm-automation / napalm-nxos

Apache License 2.0
9 stars 21 forks source link

load_replace_candidate() fails if filename exists in bootflash #75

Closed briantsaunders closed 6 years ago

briantsaunders commented 7 years ago

Description of Issue/Question

Connecting to Nexus 5672UP via NAPALM nxos driver and performing a device.load_replace_candidate(filename=filename). If there is an existing file in the bootflash that has that same filename the load_replace_candidate() fails.

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

[x ] Yes [ ] No

Setup

napalm-nxos version

(Paste verbatim output from pip freeze | grep napalm-nxos between quotes below)

napalm-nxos==0.5.0

NX-OS version

(Paste verbatim output from show version | json between quotes below)

{
  "header_str": "Cisco Nexus Operating System (NX-OS) Software\nTAC support: http://www.cisco.com/tac\nDocuments: http://www.cisc
o.com/en/US/products/ps9372/tsd_products_support_series_home.html\nCopyright (c) 2002-2016, Cisco Systems, Inc. All rights reserv
ed.\nThe copyrights to certain works contained herein are owned by\nother third parties and are used and distributed under licens
e.\nSome parts of this software are covered under the GNU Public\nLicense. A copy of the license is available at\nhttp://www.gnu.
org/licenses/gpl.html.",
  "bios_ver_str": "2.1.7",
  "power_seq_ver_str": [
    "Module 1: v4.0",
    "Module 1: v4.0",
    "Module 1: version v4.0",
    "Module 1: v2.0.0.0",
    "Module not detected"
  ],
  "ucontroller_ver_str": "v0.0.0.15",
  "kickstart_ver_str": "7.3(1)N1(1)",
  "sys_ver_str": "7.3(1)N1(1)",
  "bios_cmpl_time": "06/16/2016",
  "kick_file_name": "bootflash:///n6000-uk9-kickstart.7.3.1.N1.1.bin",
  "kick_cmpl_time": "10/5/2016 19:00:00",
  "kick_tmstmp": "10/06/2016 05:19:57",
  "isan_file_name": "bootflash:///n6000-uk9.7.3.1.N1.1.bin",
  "isan_cmpl_time": "10/5/2016 19:00:00",
  "isan_tmstmp": "10/06/2016 05:21:39",
  "chassis_id": "Nexus 5672UP Chassis",
  "module_id": "Nexus 5672UP Supervisor",
  "cpu_name": "Intel(R) Xeon(R) CPU  @ 1.80",
  "memory": 8243284,
  "mem_type": "kB",
  "proc_board_id": "FOC19094Y97",
  "host_name": "NEX-5672-D",
  "bootflash_size": 7864320,
  "kern_uptm_days": 0,
  "kern_uptm_hrs": 16,
  "kern_uptm_mins": 23,
  "kern_uptm_secs": 2,
  "rr_usecs": 987232,
  "rr_ctime": "Thu Feb 16 22:54:31 2017",
  "rr_reason": "Disruptive upgrade",
  "rr_sys_ver": "7.1(0)N1(1a)",
  "rr_service": null
}

Steps to Reproduce the Issue

Have existing file in bootflash that matches filename of file being loaded via load_replace_candidate().

Error Traceback

(Paste the complete traceback of the exception between quotes below)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/napalm_nxos/nxos.py", line 206, in load_replace_candidate
    self._send_file(temp_file.name, cfg_filename)
  File "/Library/Python/2.7/site-packages/napalm_nxos/nxos.py", line 226, in _send_file
    elif not self.fc.file_already_exists():
  File "/Library/Python/2.7/site-packages/pynxos/features/file_copy.py", line 58, in file_already_exists
    dst_hash = self.get_remote_md5()
  File "/Library/Python/2.7/site-packages/pynxos/features/file_copy.py", line 85, in get_remote_md5
    if 'Structured output unsupported' in e.msg:
AttributeError: 'CLIError' object has no attribute 'msg'
mirceaulinic commented 7 years ago

Hi @briantsaunders: thanks for reporting this!

@GGabriele @jedelman8 would you have time to look into this please? Thank you!

GGabriele commented 7 years ago

@mirceaulinic Sure, I will!

GGabriele commented 7 years ago

Hi @briantsaunders , I was not able to reproduce this issue. Anyway, can I ask you something to test? It'd be great if you can do the following:

git clone https://github.com/GGabriele/pynxos
cd pynxos
sudo pip install . -U

Then test again your workflow and let me know how it goes.

briantsaunders commented 7 years ago

@GGabriele sorry for the delayed response, I'll see about testing this and get back to you.

targuan commented 7 years ago

86 may have resolved this issue

mirceaulinic commented 6 years ago

Hi @briantsaunders - we are currently in the process of reunification, please check https://napalm-automation.net/reunification/. Going forward, we'd like to ask you to submit Pull Requests and Issue to the main repository: https://github.com/napalm-automation/napalm. If this issue persists, don't hesitate to report at https://github.com/napalm-automation/napalm.

Thanks for understanding!