summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-14 12:10:49 -0700
committerSage Weil <sage@inktank.com>2013-06-14 14:09:48 -0700
commit1504e23f177fff00a794c0db76db8a8c72bc8eb7 (patch)
treeeb61eb556008e84ba18aeda8139841be4c98c799
parent0b9482bd631aada9e2ca730b6cddd51d7954fb11 (diff)
downloadceph-1504e23f177fff00a794c0db76db8a8c72bc8eb7.tar.gz
ceph-disk: work around buggy rhel/centos parted
parted on RHEL/Centos prefixes the *machine readable output* with 1b 5b 3f 31 30 33 34 68 Note that the same thing happens when you 'import readline' in python. Work around it! Signed-off-by: Sage Weil <sage@inktank.com> (cherry picked from commit 82ff72f827b9bd7f91d30a09d35e42b25d2a7344)
-rwxr-xr-xsrc/ceph-disk5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ceph-disk b/src/ceph-disk
index 3e808c78df8..6d844ad34c8 100755
--- a/src/ceph-disk
+++ b/src/ceph-disk
@@ -637,6 +637,11 @@ def get_free_partition_index(dev):
raise Error('parted failed to output anything')
lines = str(lines).splitlines(True)
+ # work around buggy libreadline(?) library in rhel/centos.
+ idiot_prefix = '\x1b\x5b\x3f\x31\x30\x33\x34\x68';
+ if lines[0].startswith(idiot_prefix):
+ lines[0] = lines[0][8:]
+
if lines[0] not in ['CHS;\n', 'CYL;\n', 'BYT;\n']:
raise Error('weird parted units', lines[0])
del lines[0]