mirror of
https://github.com/clearlinux/WALinuxAgent.git
synced 2026-09-05 21:31:41 +00:00
Fix resource disk partition format detection (#478)
With recent versions of sfdisk the -c command is deprecated and --part-type is recommended to be used instead. This use also requires the output to be stripped instead of rstripped due to a leading space.
This commit is contained in:
committed by
Hans Krijger
parent
c451b3378d
commit
cd2ee7bbb7
@@ -129,12 +129,12 @@ class ResourceDiskHandler(object):
|
||||
shellutil.run(mkfs_string)
|
||||
else:
|
||||
logger.info("GPT not detected, determining filesystem")
|
||||
ret = shellutil.run_get_output("sfdisk -q -c {0} 1".format(device))
|
||||
ptype = ret[1].rstrip()
|
||||
ret = shellutil.run_get_output("sfdisk -q --part-type {0} 1".format(device))
|
||||
ptype = ret[1].strip()
|
||||
if ptype == "7" and fs != "ntfs":
|
||||
logger.info("The partition is formatted with ntfs, updating "
|
||||
"partition type to 83")
|
||||
shellutil.run("sfdisk -c {0} 1 83".format(device))
|
||||
shellutil.run("sfdisk --part-type {0} 1 83".format(device))
|
||||
logger.info("Format partition [{0}]", mkfs_string)
|
||||
shellutil.run(mkfs_string)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user