[stable-2.8] Don't fail trying to read boot image without enable (#56126) (#56134)

* [stable-2.8] Don't fail trying to read boot image without enable (#56126)

Also add a message when network_os_image can't be acquired.
(cherry picked from commit 3d9da0c)

Co-authored-by: Nathaniel Case <ncase@redhat.com>

* Add changelog

* Fix changelog
This commit is contained in:
Nathaniel Case 2019-05-24 14:54:22 -04:00 committed by Toshio Kuratomi
parent 20d17fe0ea
commit 92e4a98219
2 changed files with 11 additions and 4 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "eos: don't fail modules without become set, instead show message and continue"

View file

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