in src/core/src/core_logic/ConfigurePatchingProcessor.py [0:0]
def __try_set_patch_mode(self):
""" Set the patch mode for the VM """
try:
self.status_handler.set_current_operation(Constants.CONFIGURE_PATCHING)
self.current_auto_os_patch_state = self.package_manager.get_current_auto_os_patch_state()
# disable auto OS updates if VM is configured for platform updates only.
# NOTE: this condition will be false for Assessment operations, since patchMode is not sent in the API request
if self.current_auto_os_patch_state != Constants.AutomaticOSPatchStates.DISABLED and self.execution_config.patch_mode == Constants.PatchModes.AUTOMATIC_BY_PLATFORM:
self.package_manager.disable_auto_os_update()
elif self.current_auto_os_patch_state == Constants.AutomaticOSPatchStates.DISABLED and self.execution_config.patch_mode == Constants.PatchModes.IMAGE_DEFAULT:
self.package_manager.revert_auto_os_update_to_system_default()
self.current_auto_os_patch_state = self.package_manager.get_current_auto_os_patch_state()
if self.execution_config.patch_mode == Constants.PatchModes.AUTOMATIC_BY_PLATFORM and self.current_auto_os_patch_state == Constants.AutomaticOSPatchStates.UNKNOWN:
# NOTE: only sending details in error objects for customer visibility on why patch state is unknown, overall configurepatching status will remain successful
self.configure_patching_exception_error = "Could not disable one or more automatic OS update services. Please check if they are configured correctly"
self.composite_logger.log_debug("Completed processing patch mode configuration.")
except Exception as error:
self.composite_logger.log_error("Error while processing patch mode configuration. [Error={0}]".format(repr(error)))
self.configure_patching_exception_error = error
self.configure_patching_successful &= False