From 6de4e7b57cd387844a43b819abd898b83fb0fc5a Mon Sep 17 00:00:00 2001 From: TristanT Date: Tue, 28 Dec 2021 22:54:20 +0100 Subject: [PATCH 1/2] initial commit for pull req --- .../src/genie/libs/clean/stages/iosxr/stages.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/clean-pkg/src/genie/libs/clean/stages/iosxr/stages.py b/pkgs/clean-pkg/src/genie/libs/clean/stages/iosxr/stages.py index 1725e209b..c547d795d 100755 --- a/pkgs/clean-pkg/src/genie/libs/clean/stages/iosxr/stages.py +++ b/pkgs/clean-pkg/src/genie/libs/clean/stages/iosxr/stages.py @@ -494,9 +494,13 @@ def update_install_repository(self, steps, device, image, error_pattern=self.error_patterns) out = device.expect( - [self.successful_operation_string], + [self.successful_operation_string, self.install_operation_aborted_pattern], trim_buffer=False, timeout=install_timeout) + error = re.search(self.install_operation_aborted_pattern, out.match_output) + if error: + device.execute("show install log " + error.groupdict()['id']) + step.failed("The command '{cmd}' aborted ".format(cmd=cmd)) except Exception as e: step.failed("The command '{cmd}' failed. Error: {e}" .format(cmd=cmd, e=str(e))) @@ -538,9 +542,14 @@ def install_activate(self, steps, device, install_timeout=INSTALL_TIMEOUT): device.spawn, timeout=install_timeout) # Wait for successful output - device.expect( - [self.successful_operation_string], + out = device.expect( + [self.successful_operation_string, self.install_operation_aborted_pattern], + trim_buffer=False, timeout=install_timeout) + error = re.search(self.install_operation_aborted_pattern, out.match_output) + if error: + device.execute("show install log " + error.groupdict()['id']) + step.failed("The command '{cmd}' aborted ".format(cmd=cmd)) except Exception as e: step.failed("Attempting to activate install id '{id}' " "failed. Error: {e}" From 044592bfdb7e93881805d04f2aff129d5b9ecbb4 Mon Sep 17 00:00:00 2001 From: TristanT Date: Wed, 19 Jan 2022 10:51:52 +0100 Subject: [PATCH 2/2] adding changelog file --- ...allimagesandpackages_improvement_20220119105121.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 pkgs/clean-pkg/changelog/undistributed/changelog_xr_clean_installimagesandpackages_improvement_20220119105121.rst diff --git a/pkgs/clean-pkg/changelog/undistributed/changelog_xr_clean_installimagesandpackages_improvement_20220119105121.rst b/pkgs/clean-pkg/changelog/undistributed/changelog_xr_clean_installimagesandpackages_improvement_20220119105121.rst new file mode 100644 index 000000000..080cbbefd --- /dev/null +++ b/pkgs/clean-pkg/changelog/undistributed/changelog_xr_clean_installimagesandpackages_improvement_20220119105121.rst @@ -0,0 +1,10 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* IOSXR + * Modified: + * Clean Stage: + * InstallImagesAndPackages: + * Enhancement to handle CLI install add/activate in 'synchronous' mode and in standard mode + * Better catch the potential error message when the install is running in the background +