ceph_volume: add destroy option support

The zap action from ceph_volume module always implies `--destroy`.
This commit adds the destroy option support so we can ask ceph-volume to
not use `--destroy` when zapping a device.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4863/head
Guillaume Abrioux 2019-12-10 15:57:42 +01:00 committed by Dimitri Savineau
parent 4833b85e04
commit 0dcacdbed0
1 changed files with 4 additions and 1 deletions

View File

@ -461,11 +461,13 @@ def zap_devices(module, container_image):
wal = module.params.get('wal', None)
wal_vg = module.params.get('wal_vg', None)
osd_fsid = module.params.get('osd_fsid', None)
destroy = module.params.get('destroy', True)
# build the CLI
action = ['lvm', 'zap']
cmd = build_ceph_volume_cmd(action, container_image)
cmd.append('--destroy')
if destroy:
cmd.append('--destroy')
if osd_fsid:
cmd.extend(['--osd-fsid', osd_fsid])
@ -516,6 +518,7 @@ def run_module():
report=dict(type='bool', required=False, default=False),
containerized=dict(type='str', required=False, default=False),
osd_fsid=dict(type='str', required=False),
destroy=dict(type='bool', required=False, default=True),
)
module = AnsibleModule(