Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph-volume: add support check mode (backport #7501) #7510

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion library/ceph_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,23 @@ def zap_devices(module, container_image):
return cmd


def allowed_in_check_mode(module):
'''
Check if the action is allowed in check mode
'''

action = module.params['action']
report = module.params.get('report', False)

# batch is allowed in check mode if report is set
if action == 'batch' and report:
return True

allowed_actions = ['list', 'inventory']

return action in allowed_actions


def run_module():
module_args = dict(
cluster=dict(type='str', required=False, default='ceph'),
Expand Down Expand Up @@ -524,7 +541,7 @@ def run_module():
delta='',
)

if module.check_mode:
if module.check_mode and not allowed_in_check_mode(module):
module.exit_json(**result)

# start execution
Expand Down
Loading