Add new patch metadata to block apply in upgrade
This commit introduces a new patch metadata tag to indicate that the patch cannot be applied in an upgrade, that it can only be applied when the running release matches the patch. Story: 2006590 Task: 36890 Change-Id: I1b64e254e12c54695ca3691cfb7e446866089707 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
4a763b037f
commit
5153ec7f92
|
@ -324,6 +324,10 @@ def print_patch_show_result(req):
|
||||||
print(textwrap.fill(" {0:<15} ".format("RR:") + pd[patch_id]["reboot_required"],
|
print(textwrap.fill(" {0:<15} ".format("RR:") + pd[patch_id]["reboot_required"],
|
||||||
width=TERM_WIDTH, subsequent_indent=' ' * 20))
|
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"] != "":
|
if "summary" in pd[patch_id] and pd[patch_id]["summary"] != "":
|
||||||
print(textwrap.fill(" {0:<15} ".format("Summary:") + pd[patch_id]["summary"],
|
print(textwrap.fill(" {0:<15} ".format("Summary:") + pd[patch_id]["summary"],
|
||||||
width=TERM_WIDTH, subsequent_indent=' ' * 20))
|
width=TERM_WIDTH, subsequent_indent=' ' * 20))
|
||||||
|
|
|
@ -1074,6 +1074,19 @@ class PatchController(PatchService):
|
||||||
if not id_verification:
|
if not id_verification:
|
||||||
return dict(info=msg_info, warning=msg_warning, error=msg_error)
|
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
|
# Next, check the patch dependencies
|
||||||
# required_patches will map the required patch to the patches that need it
|
# required_patches will map the required patch to the patches that need it
|
||||||
required_patches = {}
|
required_patches = {}
|
||||||
|
|
|
@ -485,7 +485,8 @@ class PatchData(object):
|
||||||
"summary",
|
"summary",
|
||||||
"description",
|
"description",
|
||||||
"install_instructions",
|
"install_instructions",
|
||||||
"warnings"]:
|
"warnings",
|
||||||
|
"apply_active_release_only"]:
|
||||||
value = root.findtext(key)
|
value = root.findtext(key)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
self.metadata[patch_id][key] = value
|
self.metadata[patch_id][key] = value
|
||||||
|
@ -659,6 +660,7 @@ class PatchMetadata(object):
|
||||||
self.status = None
|
self.status = None
|
||||||
self.unremovable = None
|
self.unremovable = None
|
||||||
self.reboot_required = None
|
self.reboot_required = None
|
||||||
|
self.apply_active_release_only = None
|
||||||
self.requires = []
|
self.requires = []
|
||||||
self.groups = {}
|
self.groups = {}
|
||||||
self.contents = {}
|
self.contents = {}
|
||||||
|
@ -724,6 +726,8 @@ class PatchMetadata(object):
|
||||||
self.unremovable)
|
self.unremovable)
|
||||||
add_text_tag_to_xml(top, 'reboot_required',
|
add_text_tag_to_xml(top, 'reboot_required',
|
||||||
self.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()):
|
for groupname in sorted(self.groups.keys()):
|
||||||
if self.groups[groupname]:
|
if self.groups[groupname]:
|
||||||
|
@ -1038,7 +1042,7 @@ class PatchFile(object):
|
||||||
if field is None:
|
if field is None:
|
||||||
for f in ["status", "sw_version", "unremovable", "summary",
|
for f in ["status", "sw_version", "unremovable", "summary",
|
||||||
"description", "install_instructions",
|
"description", "install_instructions",
|
||||||
"warnings", "reboot_required"]:
|
"warnings", "reboot_required", "apply_active_release_only"]:
|
||||||
r[f] = thispatch.query_line(patch_id, f)
|
r[f] = thispatch.query_line(patch_id, f)
|
||||||
else:
|
else:
|
||||||
if field not in ['id', 'cert']:
|
if field not in ['id', 'cert']:
|
||||||
|
@ -1267,7 +1271,8 @@ def patch_build():
|
||||||
'storage=',
|
'storage=',
|
||||||
'all-nodes=',
|
'all-nodes=',
|
||||||
'pre-apply=',
|
'pre-apply=',
|
||||||
'pre-remove='])
|
'pre-remove=',
|
||||||
|
'apply-active-release-only'])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print("Usage: %s [ <args> ] ... <rpm list>"
|
print("Usage: %s [ <args> ] ... <rpm list>"
|
||||||
% os.path.basename(sys.argv[0]))
|
% os.path.basename(sys.argv[0]))
|
||||||
|
@ -1289,6 +1294,11 @@ def patch_build():
|
||||||
print("\t--controller-worker <rpm> New package for combined node")
|
print("\t--controller-worker <rpm> New package for combined node")
|
||||||
print("\t--controller-worker-lowlatency <rpm> New package for lowlatency combined node")
|
print("\t--controller-worker-lowlatency <rpm> New package for lowlatency combined node")
|
||||||
print("\t--all-nodes <rpm> New package for all node types")
|
print("\t--all-nodes <rpm> New package for all node types")
|
||||||
|
print("\t--pre-apply <script> Add pre-apply semantic check")
|
||||||
|
print("\t--pre-remove <script> Add pre-remove semantic check")
|
||||||
|
print("\t--apply-active-release-only Patch can only be applied if corresponding")
|
||||||
|
print("\t release is active")
|
||||||
|
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
pf = PatchFile()
|
pf = PatchFile()
|
||||||
|
@ -1339,6 +1349,8 @@ def patch_build():
|
||||||
pf.add_semantic(constants.SEMANTIC_PREAPPLY, arg)
|
pf.add_semantic(constants.SEMANTIC_PREAPPLY, arg)
|
||||||
elif opt == "--pre-remove":
|
elif opt == "--pre-remove":
|
||||||
pf.add_semantic(constants.SEMANTIC_PREREMOVE, arg)
|
pf.add_semantic(constants.SEMANTIC_PREREMOVE, arg)
|
||||||
|
elif opt == "--apply-active-release-only":
|
||||||
|
pf.meta.apply_active_release_only = "Y"
|
||||||
|
|
||||||
if pf.meta.id is None:
|
if pf.meta.id is None:
|
||||||
print("The --id argument is mandatory.")
|
print("The --id argument is mandatory.")
|
||||||
|
|
Loading…
Reference in New Issue