def execute_handler_action()

in src/extension/src/EnableCommandHandler.py [0:0]


    def execute_handler_action(self):
        """ Responsible for taking appropriate action for enable command as per the request sent in Handler Configuration file by user """
        try:
            # fetch seq_no
            self.seq_no = self.ext_config_settings_handler.get_seq_no(is_enable_request=True)
            if self.seq_no is None:
                self.logger.log_error("Sequence number for current operation not found")
                exit(Constants.ExitCode.ConfigurationError)

            # read status file, to load any preserve existing context
            self.ext_output_status_handler.read_file(self.seq_no)

            config_settings = self.ext_config_settings_handler.read_file(self.seq_no)

            # set activity_id in telemetry
            if self.telemetry_writer is not None:
                self.telemetry_writer.set_operation_id(config_settings.__getattribute__(self.config_public_settings.activity_id))

            operation = config_settings.__getattribute__(self.config_public_settings.operation)

            # Allow only certain operations
            if operation not in [Constants.NOOPERATION, Constants.ASSESSMENT, Constants.INSTALLATION, Constants.CONFIGURE_PATCHING]:
                self.logger.log_error("Requested operation is not supported by the extension")
                self.ext_output_status_handler.write_status_file(operation, self.seq_no, status=Constants.Status.Error.lower(), message="Requested operation {0} is not supported by the extension".format(str(operation)), code=Constants.ExitCode.OperationNotSupported)
                exit(Constants.ExitCode.OperationNotSupported)

            prev_patch_max_end_time = self.cmd_exec_start_time + datetime.timedelta(hours=0, minutes=Constants.ENABLE_MAX_RUNTIME)
            self.ext_state_handler.create_file(self.seq_no, operation, prev_patch_max_end_time)
            core_state_content = self.core_state_handler.read_file()

            # log tmp folder size
            self.ext_env_handler.log_temp_folder_details()

            # if NoOperation is requested, terminate all running processes from previous operation and update status file
            if operation == Constants.NOOPERATION:
                self.process_nooperation(config_settings, core_state_content)
            else:
                # if any of the other operations are requested, verify if request is a new request or a re-enable, by comparing sequence number from the prev request and current one
                if core_state_content is None or core_state_content.__getattribute__(self.core_state_fields.number) is None:
                    # first patch request for the VM
                    self.logger.log("No state information was found for any previous patch operation. Launching a new patch operation.")
                    self.launch_new_process(config_settings, create_status_output_file=True)
                else:
                    if int(core_state_content.__getattribute__(self.core_state_fields.number)) != int(self.seq_no):
                        # new request
                        self.process_enable_request(config_settings, prev_patch_max_end_time, core_state_content)
                    else:
                        # re-enable request
                        self.process_reenable_request(config_settings, core_state_content)

        except Exception as error:
            self.logger.log_error("Failed to execute enable. [Exception={0}]".format(repr(error)))
            raise