Skip to content

Commit fbc2e26

Browse files
authored
Updating automaticOSPatchState property name in status and incrementing extension version for a new release (#84)
1 parent 25c17b0 commit fbc2e26

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

src/core/src/bootstrap/Constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __iter__(self):
3030
UNKNOWN = "Unknown"
3131

3232
# Extension version (todo: move to a different file)
33-
EXT_VERSION = "1.6.22"
33+
EXT_VERSION = "1.6.23"
3434

3535
# Runtime environments
3636
TEST = 'Test'
@@ -105,7 +105,7 @@ class AssessmentModes(EnumBackport):
105105
AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform"
106106

107107
# automatic OS patch states for configure patching
108-
class AutomaticOsPatchStates(EnumBackport):
108+
class AutomaticOSPatchStates(EnumBackport):
109109
UNKNOWN = "Unknown"
110110
DISABLED = "Disabled"
111111
ENABLED = "Enabled"

src/core/src/core_logic/ConfigurePatchingProcessor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, env_layer, execution_config, composite_logger, telemetry_writ
3232
self.auto_assess_timer_manager = auto_assess_timer_manager
3333
self.lifecycle_manager = lifecycle_manager
3434

35-
self.current_auto_os_patch_state = Constants.AutomaticOsPatchStates.UNKNOWN
35+
self.current_auto_os_patch_state = Constants.AutomaticOSPatchStates.UNKNOWN
3636
self.current_auto_assessment_state = Constants.AutoAssessmentStates.UNKNOWN
3737
self.configure_patching_successful = True
3838

@@ -69,7 +69,7 @@ def __try_set_patch_mode(self):
6969

7070
# disable auto OS updates if VM is configured for platform updates only.
7171
# NOTE: this condition will be false for Assessment operations, since patchMode is not sent in the API request
72-
if self.current_auto_os_patch_state == Constants.AutomaticOsPatchStates.ENABLED and self.execution_config.patch_mode == Constants.PatchModes.AUTOMATIC_BY_PLATFORM:
72+
if self.current_auto_os_patch_state == Constants.AutomaticOSPatchStates.ENABLED and self.execution_config.patch_mode == Constants.PatchModes.AUTOMATIC_BY_PLATFORM:
7373
self.package_manager.disable_auto_os_update()
7474

7575
self.current_auto_os_patch_state = self.package_manager.get_current_auto_os_patch_state()

src/core/src/package_managers/AptitudePackageManager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ def get_current_auto_os_patch_state(self):
373373
self.composite_logger.log("Fetching the current automatic OS patch state on the machine...")
374374
self.__get_current_auto_os_updates_setting_on_machine()
375375
if int(self.unattended_upgrade_value) == 0:
376-
return Constants.AutomaticOsPatchStates.DISABLED
376+
return Constants.AutomaticOSPatchStates.DISABLED
377377
elif int(self.unattended_upgrade_value) == 1:
378-
return Constants.AutomaticOsPatchStates.ENABLED
378+
return Constants.AutomaticOSPatchStates.ENABLED
379379
else:
380-
return Constants.AutomaticOsPatchStates.UNKNOWN
380+
return Constants.AutomaticOSPatchStates.UNKNOWN
381381

382382
def __get_current_auto_os_updates_setting_on_machine(self):
383383
""" Gets all the update settings related to auto OS updates currently set on the machine """

src/core/src/service_interfaces/StatusHandler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def __new_patch_metadata_for_healthstore_json(self, patch_version=Constants.PATC
383383
}
384384

385385
def set_configure_patching_substatus_json(self, status=Constants.STATUS_TRANSITIONING, code=0,
386-
automatic_os_patch_state=Constants.AutomaticOsPatchStates.UNKNOWN,
386+
automatic_os_patch_state=Constants.AutomaticOSPatchStates.UNKNOWN,
387387
auto_assessment_state=Constants.AutoAssessmentStates.UNKNOWN):
388388
""" Prepare the configure patching substatus json including the message containing configure patching summary """
389389
self.composite_logger.log_debug("Setting configure patching substatus. [Substatus={0}]".format(str(status)))
@@ -407,7 +407,7 @@ def __new_configure_patching_summary_json(self, automatic_os_patch_state, auto_a
407407
"activityId": str(self.execution_config.activity_id),
408408
"startTime": str(self.execution_config.start_time),
409409
"lastModifiedTime": str(self.env_layer.datetime.timestamp()),
410-
"automaticOsPatchState": automatic_os_patch_state,
410+
"automaticOSPatchState": automatic_os_patch_state,
411411
"autoAssessmentStatus": {
412412
"autoAssessmentState": auto_assessment_state,
413413
"errors": self.__set_errors_json(self.__configure_patching_auto_assessment_error_count, self.__configure_patching_auto_assessment_errors)
@@ -670,7 +670,7 @@ def add_error_to_status(self, message, error_code=Constants.PatchOperationErrorC
670670

671671
# retain previously set status, code, patchMode and M for configure patching substatus
672672
if self.__configure_patching_substatus_json is not None:
673-
automatic_os_patch_state = json.loads(self.__configure_patching_substatus_json["formattedMessage"]["message"])["automaticOsPatchState"]
673+
automatic_os_patch_state = json.loads(self.__configure_patching_substatus_json["formattedMessage"]["message"])["automaticOSPatchState"]
674674
auto_assessment_status = self.__json_try_get_key_value(self.__configure_patching_substatus_json["formattedMessage"]["message"],"autoAssessmentStatus","{}")
675675
auto_assessment_state = self.__json_try_get_key_value(json.dumps(auto_assessment_status), "autoAssessmentState", Constants.AutoAssessmentStates.UNKNOWN)
676676
self.set_configure_patching_substatus_json(status=self.__configure_patching_substatus_json["status"], code=self.__configure_patching_substatus_json["code"],

src/core/tests/Test_ConfigurePatchingProcessor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_operation_success_for_configure_patching_request_for_apt(self):
7070
self.assertTrue(substatus_file_data[0]["name"] == Constants.CONFIGURE_PATCHING_SUMMARY)
7171
self.assertTrue(substatus_file_data[0]["status"].lower() == Constants.STATUS_SUCCESS.lower())
7272
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
73-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED)
73+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED)
7474

7575
# check status file for configure patching assessment state
7676
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
@@ -205,7 +205,7 @@ def test_configure_patching_with_assessment_mode_by_platform(self):
205205
self.assertTrue(substatus_file_data[0]["name"] == Constants.CONFIGURE_PATCHING_SUMMARY)
206206
self.assertTrue(substatus_file_data[0]["status"].lower() == Constants.STATUS_SUCCESS.lower())
207207
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
208-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.ENABLED) # no change is made on Auto OS updates for patch mode 'ImageDefault'
208+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.ENABLED) # no change is made on Auto OS updates for patch mode 'ImageDefault'
209209

210210
# check status file for configure patching assessment state
211211
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
@@ -248,7 +248,7 @@ def test_configure_patching_with_patch_mode_and_assessment_mode_by_platform(self
248248
self.assertTrue(substatus_file_data[0]["name"] == Constants.CONFIGURE_PATCHING_SUMMARY)
249249
self.assertTrue(substatus_file_data[0]["status"].lower() == Constants.STATUS_SUCCESS.lower())
250250
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
251-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled on patch mode 'AutomaticByPlatform'
251+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled on patch mode 'AutomaticByPlatform'
252252

253253
# check status file for configure patching assessment state
254254
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])

src/core/tests/Test_CoreMain.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def test_auto_assessment_success_with_configure_patching_in_prev_operation_on_sa
457457
self.assertTrue(substatus_file_data[0]["status"].lower() == Constants.STATUS_SUCCESS.lower())
458458
# check status file for configure patching auto updates state
459459
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
460-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
460+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
461461
# check status file for configure patching assessment state
462462
message = json.loads(substatus_file_data[0]["formattedMessage"]["message"])
463463
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.ENABLED) # auto assessment is enabled
@@ -490,7 +490,7 @@ def test_auto_assessment_success_with_configure_patching_in_prev_operation_on_sa
490490
self.assertTrue(substatus_file_data[1]["name"] == Constants.CONFIGURE_PATCHING_SUMMARY)
491491
self.assertTrue(substatus_file_data[1]["status"].lower() == Constants.STATUS_SUCCESS.lower())
492492
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
493-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
493+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
494494
# check status file for configure patching assessment state
495495
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
496496
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.ENABLED) # auto assessment is enabled
@@ -521,7 +521,7 @@ def test_auto_assessment_success_with_assessment_in_prev_operation_on_same_seque
521521
self.assertTrue(substatus_file_data[1]["status"].lower() == Constants.STATUS_SUCCESS.lower())
522522
# check status file for configure patching auto updates state
523523
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
524-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
524+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
525525
# check status file for configure patching assessment state
526526
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
527527
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.UNKNOWN) # Configure patching for auto assessment did not execute since assessmentMode was not in input
@@ -556,7 +556,7 @@ def test_auto_assessment_success_with_assessment_in_prev_operation_on_same_seque
556556
self.assertTrue(substatus_file_data[1]["status"].lower() == Constants.STATUS_SUCCESS.lower())
557557
# check status file for configure patching auto updates state
558558
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
559-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
559+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
560560
# check status file for configure patching assessment state
561561
message = json.loads(substatus_file_data[1]["formattedMessage"]["message"])
562562
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.UNKNOWN) # Configure patching for auto assessment did not execute since assessmentMode was not in input
@@ -595,7 +595,7 @@ def test_auto_assessment_success_with_installation_in_prev_operation_on_same_seq
595595
self.assertTrue(substatus_file_data[3]["status"].lower() == Constants.STATUS_SUCCESS.lower())
596596
# check status file for configure patching auto updates state
597597
message = json.loads(substatus_file_data[3]["formattedMessage"]["message"])
598-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor, this is tested in Test-ConfigurePatchingProcessor
598+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor, this is tested in Test-ConfigurePatchingProcessor
599599
# check status file for configure patching assessment state
600600
message = json.loads(substatus_file_data[3]["formattedMessage"]["message"])
601601
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.UNKNOWN) # Configure patching for auto assessment did not execute since assessmentMode was not in input
@@ -637,7 +637,7 @@ def test_auto_assessment_success_with_installation_in_prev_operation_on_same_seq
637637
self.assertTrue(substatus_file_data[3]["status"].lower() == Constants.STATUS_SUCCESS.lower())
638638
# check status file for configure patching auto updates state
639639
message = json.loads(substatus_file_data[3]["formattedMessage"]["message"])
640-
self.assertEqual(message["automaticOsPatchState"], Constants.AutomaticOsPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
640+
self.assertEqual(message["automaticOSPatchState"], Constants.AutomaticOSPatchStates.DISABLED) # auto OS updates are disabled in RuntimeCompositor
641641
# check status file for configure patching assessment state
642642
message = json.loads(substatus_file_data[3]["formattedMessage"]["message"])
643643
self.assertEqual(message["autoAssessmentStatus"]["autoAssessmentState"], Constants.AutoAssessmentStates.UNKNOWN) # Configure patching for auto assessment did not execute since assessmentMode was not in input

src/core/tests/library/RuntimeCompositor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def check_sudo_status(self, raise_if_not_sudo=True):
142142
return True
143143

144144
def get_current_auto_os_patch_state(self):
145-
return Constants.AutomaticOsPatchStates.DISABLED
145+
return Constants.AutomaticOSPatchStates.DISABLED
146146

147147
def mock_urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, cafile=None, capath=None, cadefault=False, context=None):
148148
resp = urlreq.addinfourl(StringIO("mock file"), "mock message", "mockurl")

src/extension/src/Constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __iter__(self):
2828
yield item
2929

3030
# Extension version (todo: move to a different file)
31-
EXT_VERSION = "1.6.22"
31+
EXT_VERSION = "1.6.23"
3232

3333
# Runtime environments
3434
TEST = 'Test'

src/extension/src/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ExtensionImage xmlns="http://schemas.microsoft.com/windowsazure">
33
<ProviderNameSpace>Microsoft.CPlat.Core</ProviderNameSpace>
44
<Type>LinuxPatchExtension</Type>
5-
<Version>1.6.22</Version>
5+
<Version>1.6.23</Version>
66
<Label>Microsoft Azure VM InGuest Patch Extension for Linux Virtual Machines</Label>
77
<HostingResources>VmRole</HostingResources>
88
<MediaLink></MediaLink>

0 commit comments

Comments
 (0)