From 58be4d0e18c4b2f3560361345f91c5a1c7b6c5c4 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 28 Nov 2018 07:56:34 -0500 Subject: [PATCH] ceph-volume util.arg_validators optionally skip gpt header check Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/util/arg_validators.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/util/arg_validators.py b/src/ceph-volume/ceph_volume/util/arg_validators.py index 534c9aa646736..a04c19924bbd0 100644 --- a/src/ceph-volume/ceph_volume/util/arg_validators.py +++ b/src/ceph-volume/ceph_volume/util/arg_validators.py @@ -8,15 +8,22 @@ from ceph_volume.util.device import Device class ValidDevice(object): - def __init__(self, as_string=False): + def __init__(self, as_string=False, gpt_ok=False): self.as_string = as_string + self.gpt_ok = gpt_ok def __call__(self, string): device = Device(string) error = None if not device.exists: error = "Unable to proceed with non-existing device: %s" % string - elif device.has_gpt_headers: + # FIXME this is not a nice API, this validator was meant to catch any + # non-existing devices upfront, not check for gpt headers. Now this + # needs to optionally skip checking gpt headers which is beyond + # verifying if the device exists. The better solution would be to + # configure this with a list of checks that can be excluded/included on + # __init__ + elif device.has_gpt_headers and not self.gpt_ok: error = "GPT headers found, they must be removed on: %s" % string if error: -- 2.39.5