Skip to content

Commit

Permalink
Fix for testcase failing in 3.5.6 (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahkumar651991 committed Feb 4, 2020
1 parent c939808 commit 2181ad7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/jnpr/jsnapy/jsnapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2181ad7

Please sign in to comment.