From 9be64fb00fdfac044aadffe1953b67c08a6204ad Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Fri, 3 Jun 2016 11:43:26 -0400 Subject: [PATCH] ceph-disk: remove try/except for CalledProcessError to use new exit flag handler Signed-off-by: Alfredo Deza --- src/ceph-disk/ceph_disk/main.py | 34 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index d2d8d230853..7cc49385de1 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -1575,7 +1575,8 @@ class Device(object): '--mbrtogpt', '--', self.path, - ] + ], + exit=True ) update_partition(self.path, 'created') return num @@ -2727,12 +2728,9 @@ class PrepareData(object): '--', partition.get_dev(), ]) - try: - LOG.debug('Creating %s fs on %s', - self.args.fs_type, partition.get_dev()) - command_check_call(args) - except subprocess.CalledProcessError as e: - raise Error(e) + LOG.debug('Creating %s fs on %s', + self.args.fs_type, partition.get_dev()) + command_check_call(args, exit=True) path = mount(dev=partition.get_dev(), fstype=self.args.fs_type, @@ -2748,18 +2746,16 @@ class PrepareData(object): partition.unmap() if not is_partition(self.args.data): - try: - command_check_call( - [ - 'sgdisk', - '--typecode=%d:%s' % (partition.get_partition_number(), - partition.ptype_for_name('osd')), - '--', - self.args.data, - ], - ) - except subprocess.CalledProcessError as e: - raise Error(e) + command_check_call( + [ + 'sgdisk', + '--typecode=%d:%s' % (partition.get_partition_number(), + partition.ptype_for_name('osd')), + '--', + self.args.data, + ], + exit=True, + ) update_partition(self.args.data, 'prepared') command_check_call(['udevadm', 'trigger', '--action=add', -- 2.39.5