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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we emit a warning/info instead of silently failing There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
||
|
There was a problem hiding this comment.
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
?