From 0b3c8f2f1e752641863a588eb8d076b8c0c50df0 Mon Sep 17 00:00:00 2001 From: rahkumar651991 Date: Mon, 3 Feb 2020 16:46:45 +0530 Subject: [PATCH] Fix for testcase failing in 3.5.6 --- lib/jnpr/jsnapy/jsnapy.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/jnpr/jsnapy/jsnapy.py b/lib/jnpr/jsnapy/jsnapy.py index 103e3a63..502bde85 100755 --- a/lib/jnpr/jsnapy/jsnapy.py +++ b/lib/jnpr/jsnapy/jsnapy.py @@ -487,19 +487,21 @@ def login(self, output_file): gp = first_entry.get('group', 'all') dgroup = [i.strip().lower() for i in gp.split(',')] + iter = 0 for dgp in dev_file: if dgroup[0].lower() == 'all' or dgp.lower() in dgroup: - for counter, val in enumerate(dev_file[dgp]): + for val in dev_file[dgp]: # There can be multiple values of device/hostname # The values can have same hostname but different port # key for the dictionary modified from hostname to enumerate value to keep distinction + iter += 1 hostname = list(val)[0] self.log_detail = {'hostname': hostname} if val.get(hostname) is not None and hostname not in self.host_list: #host_dict[hostname] = deepcopy(val.get(hostname)) self.host_list.append(hostname) - host_dict[counter] = deepcopy(val.get(hostname)) - host_dict[counter]["device"] = hostname + host_dict[iter] = deepcopy(val.get(hostname)) + host_dict[iter]["device"] = hostname # login credentials are given in main config file, can connect to multiple devices else: