Skip to content

Commit

Permalink
Don't fail trying to read boot image without enable (ansible#56126)
Browse files Browse the repository at this point in the history
Also add a message when network_os_image can't be acquired.
  • Loading branch information
Qalthos authored May 6, 2019
1 parent fef1a10 commit 3d9da0c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/ansible/plugins/cliconf/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,15 @@ def get_device_info(self):

device_info['network_os_hostname'] = data['hostname']

reply = self.get('bash timeout 5 cat /mnt/flash/boot-config')
match = re.search(r'SWI=(.+)$', reply, re.M)
if match:
device_info['network_os_image'] = match.group(1)
try:
reply = self.get('bash timeout 5 cat /mnt/flash/boot-config')

match = re.search(r'SWI=(.+)$', reply, re.M)
if match:
device_info['network_os_image'] = match.group(1)
except AnsibleConnectionFailure:
# This requires enable mode to run
self._connection.queue_message('vvv', "Unable to gather network_os_image without enable mode")

return device_info

Expand Down

0 comments on commit 3d9da0c

Please sign in to comment.