X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FInstallPartitionDisks.py;h=e40a2337e211d6c50089a0acdbe001302c8f4e83;hb=918c1b2a985bbf003fbabfa861dd0db492edd3d3;hp=81d100d23f59126e32b146480e57190f76c87e41;hpb=4d7ebcb2f75108f95484a4000cca2489c4ef32b1;p=bootmanager.git diff --git a/source/steps/InstallPartitionDisks.py b/source/steps/InstallPartitionDisks.py index 81d100d..e40a233 100644 --- a/source/steps/InstallPartitionDisks.py +++ b/source/steps/InstallPartitionDisks.py @@ -183,20 +183,27 @@ def single_partition_device( device, vars, log ): """ # two forms, depending on which version of pyparted we have + # v1 does not have a 'version' method + # v2 and above does, but to make it worse, + # parted-3.4 on f14 has parted.version broken and raises SystemError try: - version=parted.version() + parted.version() return single_partition_device_2_x (device, vars, log) - except: + except AttributeError: + # old parted does not have version at all return single_partition_device_1_x (device, vars, log) - - + except SystemError: + # let's assume this is >=2 + return single_partition_device_2_x (device, vars, log) + except: + raise def single_partition_device_1_x ( device, vars, log): lvm_flag= parted.partition_flag_get_by_name('lvm') try: - print >>log, "Using pyparted 1.x" + log.write("Using pyparted 1.x\n") # wipe the old partition table utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log ) @@ -239,7 +246,7 @@ def single_partition_device_1_x ( device, vars, log): def single_partition_device_2_x ( device, vars, log): try: - print >>log, "Using pyparted 2.x" + log.write("Using pyparted 2.x\n") # wipe the old partition table utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log ) # get the device