From: Alfredo Deza Date: Wed, 28 Nov 2018 12:56:34 +0000 (-0500) Subject: ceph-volume util.arg_validators optionally skip gpt header check X-Git-Tag: v13.2.5~144^2~2^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cff6096efbb55a0e6ee82181d46e11748ad01751;p=ceph.git ceph-volume util.arg_validators optionally skip gpt header check Signed-off-by: Alfredo Deza (cherry picked from commit 58be4d0e18c4b2f3560361345f91c5a1c7b6c5c4) --- diff --git a/src/ceph-volume/ceph_volume/util/arg_validators.py b/src/ceph-volume/ceph_volume/util/arg_validators.py index 534c9aa64673..a04c19924bbd 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: