From cd2ee7bbb78ebf635afbaffdd5cafc77257ab61b Mon Sep 17 00:00:00 2001 From: William Douglas Date: Fri, 18 Nov 2016 16:06:42 -0800 Subject: [PATCH] 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. --- azurelinuxagent/daemon/resourcedisk/default.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azurelinuxagent/daemon/resourcedisk/default.py b/azurelinuxagent/daemon/resourcedisk/default.py index 9ffe280..acad045 100644 --- a/azurelinuxagent/daemon/resourcedisk/default.py +++ b/azurelinuxagent/daemon/resourcedisk/default.py @@ -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: