in src/core/src/core_logic/ExecutionConfig.py [0:0]
def __get_max_patch_publish_date_from_inclusions(self, included_package_name_mask_list):
# type (str) -> str
# This is for AzGPS mitigation mode execution for Strict safe-deployment of patches.
if included_package_name_mask_list is None or included_package_name_mask_list == str():
return str()
mitigation_mode_flag = False
mitigation_mode_flag_pos = -1
candidate = str()
candidate_pos = -1
for i in range(0, len(included_package_name_mask_list)):
if mitigation_mode_flag and candidate != str():
break # everything we're looking for has been found
if included_package_name_mask_list[i] == "AzGPS_Mitigation_Mode_No_SLA":
mitigation_mode_flag = True
mitigation_mode_flag_pos = i
continue # mitigation mode flag found
if candidate != str() or not included_package_name_mask_list[i].startswith("MaxPatchPublishDate="):
continue # good candidate already found, or candidate not found and does not match what we are looking for
candidate = included_package_name_mask_list[i].replace("MaxPatchPublishDate=", "")
try:
datetime.datetime.strptime(candidate, "%Y%m%dT%H%M%SZ")
self.composite_logger.log_debug("[EC] Discovered effective MaxPatchPublishDate in patch inclusions. [MaxPatchPublishDate={0}]".format(str(candidate)))
candidate_pos = i
except ValueError:
self.composite_logger.log_debug("[EC] Invalid match on MaxPatchPublishDate in patch inclusions. [MaxPatchPublishDate={0}]".format(str(candidate)))
candidate = str()
# if everything we're looking for is present, remove them from the list
if mitigation_mode_flag and candidate != str() and mitigation_mode_flag_pos != -1 and candidate_pos != -1:
self.composite_logger.log_warning("AzGPS Mitigation Mode: There is no support or SLA for execution in this mode without explicit direction from AzGPS engineering.")
included_package_name_mask_list.pop(mitigation_mode_flag_pos)
included_package_name_mask_list.pop(candidate_pos - 1 if mitigation_mode_flag_pos < candidate_pos else candidate_pos)
return candidate
return str()