mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-30 07:50:43 +00:00
[PR #12121/6e6199ae backport][stable-13] parted: ignore MBR partition type codes in flags on SUSE systems (#12147)
parted: ignore MBR partition type codes in flags on SUSE systems (#12121)
* parted: ignore MBR partition type codes reported as flags by SUSE parted
SUSE's patched parted reports MBR partition type codes (e.g., type=8e for
Linux LVM) in the machine-parseable flags output. The module was trying to
unset these pseudo-flags via 'parted set N type=8e off', which is not a
valid parted command, causing the task to fail when using flags: [lvm] on
msdos-labelled disks on SUSE systems.
Fixes #6292
* feat(changelog): add fragment for PR 12121
* Update changelogs/fragments/12121-parted-suse-msdos-type-code.yml
---------
(cherry picked from commit 6e6199ae3d)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
9821ff20c4
commit
709e596700
3 changed files with 103 additions and 3 deletions
|
|
@ -765,9 +765,12 @@ def main():
|
|||
if "esp" in flags and "boot" not in flags:
|
||||
flags.append("boot")
|
||||
|
||||
# Compute only the changes in flags status
|
||||
flags_off = list(set(partition["flags"]) - set(flags))
|
||||
flags_on = list(set(flags) - set(partition["flags"]))
|
||||
# Compute only the changes in flags status.
|
||||
# Some parted builds (e.g., SUSE) include MBR partition type codes (e.g.,
|
||||
# type=8e) in the flags output; these cannot be managed via the 'set' command.
|
||||
current_flags = [f for f in partition["flags"] if not re.match(r"^type=[0-9a-fA-F]+$", f)]
|
||||
flags_off = list(set(current_flags) - set(flags))
|
||||
flags_on = list(set(flags) - set(current_flags))
|
||||
|
||||
for f in flags_on:
|
||||
script += ["set", str(number), f, "on"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue