Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail trying to read boot image wihtout enable #56126

Merged
merged 2 commits into from May 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/ansible/plugins/cliconf/eos.py
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')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason we do this instead of show boot-config | json?


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we emit a warning/info instead of silently failing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a warning might be a bit strong for this, but I don't know what the implications of this data not being populated are.

self._connection.queue_message('vvv', "Unable to gather network_os_image without enable mode")

return device_info

Expand Down