Don't fail trying to read boot image without enable (#56126)

Also add a message when network_os_image can't be acquired.
This commit is contained in:
Nathaniel Case 2019-05-06 15:15:26 -04:00 committed by GitHub
parent fef1a10efc
commit 3d9da0c468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,10 +247,15 @@ class Cliconf(CliconfBase):
device_info['network_os_hostname'] = data['hostname'] device_info['network_os_hostname'] = data['hostname']
try:
reply = self.get('bash timeout 5 cat /mnt/flash/boot-config') reply = self.get('bash timeout 5 cat /mnt/flash/boot-config')
match = re.search(r'SWI=(.+)$', reply, re.M) match = re.search(r'SWI=(.+)$', reply, re.M)
if match: if match:
device_info['network_os_image'] = match.group(1) 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 return device_info