Skip to content

Commit f51eef0

Browse files
author
Adisorn Ermongkonchai
committed
Added note to warn user of lengthy install
1 parent 213f9e9 commit f51eef0

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

local/library/iosxr_upgrade_package

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,28 @@ def main():
122122
# make sure no other install in progress
123123
if is_install_in_progress(module):
124124
module.fail_json(msg="other install op in progress")
125-
125+
126+
# run install upgrade command
126127
command = ('install upgrade source ' +
127128
pkg_path + ' version ' + version + ' ' + pkg_name + '\r')
128129
module.connection.shell.shell.send(command)
129130

130-
# collect all responses 1024 bytes at a time
131-
prompt = re.compile(r'[\r\n]?[\w+\-\.:\/\[\]]+(?:>|#)')
132-
response = module.connection.shell.shell.recv(1024)
133-
while not prompt.search(response):
134-
response += module.connection.shell.shell.recv(1024)
131+
try:
132+
# collect all responses 1024 bytes at a time
133+
prompt = re.compile(r'[\r\n]?[\w+\-\.:\/\[\]]+(?:>|#)')
134+
response = module.connection.shell.shell.recv(1024)
135+
while not prompt.search(response):
136+
response += module.connection.shell.shell.recv(1024)
137+
except:
138+
response += '\r\nNOTE: install upgrade is running in background and can take a long time, use "show install <request|log>" command to check its status\r\n'
139+
pass
135140

136-
# exit if error
137-
result = dict(changed=False)
138-
if 'aborted' not in response:
139-
result['changed'] = True
141+
# check result
142+
if 'aborted' in response:
143+
module.fail_json(msg=response)
140144

141145
# show result
146+
result = dict(changed=True)
142147
result['stdout'] = response
143148
result['stdout_lines'] = str(result['stdout']).splitlines()
144149

0 commit comments

Comments
 (0)