diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py index 97bece37..20ab3890 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py @@ -324,6 +324,10 @@ def print_patch_show_result(req): print(textwrap.fill(" {0:<15} ".format("RR:") + pd[patch_id]["reboot_required"], width=TERM_WIDTH, subsequent_indent=' ' * 20)) + if "apply_active_release_only" in pd[patch_id] and pd[patch_id]["apply_active_release_only"] != "": + print(textwrap.fill(" {0:<15} ".format("Apply Active Release Only:") + pd[patch_id]["apply_active_release_only"], + width=TERM_WIDTH, subsequent_indent=' ' * 20)) + if "summary" in pd[patch_id] and pd[patch_id]["summary"] != "": print(textwrap.fill(" {0:<15} ".format("Summary:") + pd[patch_id]["summary"], width=TERM_WIDTH, subsequent_indent=' ' * 20)) diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py index 7a81d51d..4cbdef09 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py @@ -1074,6 +1074,19 @@ class PatchController(PatchService): if not id_verification: return dict(info=msg_info, warning=msg_warning, error=msg_error) + # Check for patches that can't be applied during an upgrade + upgrade_check = True + for patch_id in patch_list: + if self.patch_data.metadata[patch_id]["sw_version"] != SW_VERSION \ + and self.patch_data.metadata[patch_id].get("apply_active_release_only") == "Y": + msg = "%s cannot be applied in an upgrade" % patch_id + LOG.error(msg) + msg_error += msg + "\n" + upgrade_check = False + + if not upgrade_check: + return dict(info=msg_info, warning=msg_warning, error=msg_error) + # Next, check the patch dependencies # required_patches will map the required patch to the patches that need it required_patches = {} diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py index caab4aa2..832e4e95 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py @@ -485,7 +485,8 @@ class PatchData(object): "summary", "description", "install_instructions", - "warnings"]: + "warnings", + "apply_active_release_only"]: value = root.findtext(key) if value is not None: self.metadata[patch_id][key] = value @@ -659,6 +660,7 @@ class PatchMetadata(object): self.status = None self.unremovable = None self.reboot_required = None + self.apply_active_release_only = None self.requires = [] self.groups = {} self.contents = {} @@ -724,6 +726,8 @@ class PatchMetadata(object): self.unremovable) add_text_tag_to_xml(top, 'reboot_required', self.reboot_required) + add_text_tag_to_xml(top, 'apply_active_release_only', + self.apply_active_release_only) for groupname in sorted(self.groups.keys()): if self.groups[groupname]: @@ -1038,7 +1042,7 @@ class PatchFile(object): if field is None: for f in ["status", "sw_version", "unremovable", "summary", "description", "install_instructions", - "warnings", "reboot_required"]: + "warnings", "reboot_required", "apply_active_release_only"]: r[f] = thispatch.query_line(patch_id, f) else: if field not in ['id', 'cert']: @@ -1267,7 +1271,8 @@ def patch_build(): 'storage=', 'all-nodes=', 'pre-apply=', - 'pre-remove=']) + 'pre-remove=', + 'apply-active-release-only']) except getopt.GetoptError: print("Usage: %s [ ] ... " % os.path.basename(sys.argv[0])) @@ -1289,6 +1294,11 @@ def patch_build(): print("\t--controller-worker New package for combined node") print("\t--controller-worker-lowlatency New package for lowlatency combined node") print("\t--all-nodes New package for all node types") + print("\t--pre-apply