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

Fix state=list in ceph_pool module #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions plugins/modules/ceph_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
name:
description:
- name of the Ceph pool
- Required if I(state) is C(present) or C(present)
type: str
required: true
required: false
state:
description:
- If 'present' is used, the module creates a pool if it doesn't exist or update it if it already exists.
Expand Down Expand Up @@ -528,9 +529,9 @@ def update_pool(module, cluster, name,
def run_module():
module_args = dict(
cluster=dict(type='str', required=False, default='ceph'),
name=dict(type='str', required=True),
name=dict(type='str', required=False),
state=dict(type='str', required=False, default='present',
choices=['present', 'absent']),
choices=['present', 'absent', 'list']),
details=dict(type='bool', required=False, default=False),
size=dict(type='str', required=False, default='3'),
min_size=dict(type='str', required=False),
Expand Down Expand Up @@ -564,6 +565,9 @@ def run_module():
target_size_ratio = module.params.get('target_size_ratio')
application = module.params.get('application')

if state != "list" and not name:
module.fail_json("state change requires a pool name")

if (module.params.get('pg_autoscale_mode').lower() in
['true', 'on', 'yes']):
pg_autoscale_mode = 'on'
Expand Down Expand Up @@ -679,7 +683,7 @@ def run_module():
elif state == "list":
rc, cmd, out, err = exec_command(module,
list_pools(cluster,
name, user,
user,
user_key,
details,
container_image=container_image)) # noqa: E501
Expand Down