Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/src/service_interfaces/LifecycleManagerArc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def execution_start_check(self):

# Signalling take-over of core state by auto-assessment after safety checks for any competing process
self.update_core_sequence(completed=False)
# Refresh status file in memory to be up-to-date
self.status_handler.load_status_file_components()
else:
# Logic for all non-Auto-assessment operations
extension_sequence = self.read_extension_sequence()
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/service_interfaces/LifecycleManagerAzure.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def execution_start_check(self):

# Signalling take-over of core state by auto-assessment after safety checks for any competing process
self.update_core_sequence(completed=False)
# Refresh status file in memory to be up-to-date
self.status_handler.load_status_file_components()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should this be done on line 120 so it is done for both cases?
  2. Should it be done in all code paths within update_core_sequence? Update_core_sequence has an early return.
  3. What about all invocations of update_core_sequence? Should it be done there as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The second case should already have up-to-date status file information because there isn't any delay there. It isn't needed on line 120 but can be moved there.
  2. Core sequence is read at the beginning of each loop within the execution_start_check method, so it should always have up-to-date information.
  3. I don't think this is needed. It's only needed in areas of contention when there are multiple core processes running at the same time, and this is already taken care of (as mentioned above).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Test this change on a machine with Auto Patching and Auto Assessment
  2. We don't have any tests mocking Auto assessment behavior, to test this scenario. See if it's possible to add that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Tested on a machine with those attributes, works as intended.
  2. Looking into it.

Copy link
Contributor

@rane-rajasi rane-rajasi Jul 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing on a machine, check/follow these:

  1. Create a VM with Auto Patching and Auto Assessment i.e. patchmode = AutomaticByPlatform and assessmentmode = AutomaticByPlatform
  2. Check if ConfigurePatching call is triggered. If not, manually invoke ConfigurePatching API. This first ConfigurePatching call should timeout.
  3. Update the code.
  4. Call ConfigurePatching again.
  5. Keep on monitoring the API result. Query ContextActivity for the second and check ConfigurePatchingSummary, it should report status as Success. This is the bug fix
  6. This part is optional and not a validation for the bug fix. In case you want to verify whether Auto Assessment completed, wait for sometime and then check auto assessment log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a task in our backlog for AutoAssessment tests

else:
# Logic for all non-Auto-assessment operations
extension_sequence = self.read_extension_sequence()
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/service_interfaces/StatusHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, env_layer, execution_config, composite_logger, telemetry_writ
self.__configure_patching_auto_assessment_error_count = 0 # All errors relating to auto-assessment configuration.

# Load the currently persisted status file into memory
self.__load_status_file_components(initial_load=True)
self.load_status_file_components(initial_load=True)

# Tracker for reboot pending status, the value is updated externally(PatchInstaller.py) whenever package is installed. As this var is directly written in status file, setting the default to False, instead of Empty/Unknown, to maintain a true bool field as per Agent team's architecture
self.is_reboot_pending = False
Expand Down Expand Up @@ -490,7 +490,7 @@ def __json_try_get_key_value(json_body, key, default_value=""):
except KeyError:
return default_value

def __load_status_file_components(self, initial_load=False):
def load_status_file_components(self, initial_load=False):
""" Loads currently persisted status data into memory.
:param initial_load: If no status file exists AND initial_load is true, a default initial status file is created.
:return: None
Expand Down