ceph / ceph/ceph.automation

Module ''ceph_add_users_buckets.py" is not idempotent - Simple update could fix it

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
17
PR merge metrics
No merged PRs in 30d

Description

The module lack idempotency as it's important for ansible , it simply need not to consider existing users/buckets as error .
To do that simply do not raise `module.fail_json` and instead put change false to the result dict in the main function:

```
# conditional state caused a failure
if result['added_users'] == '' and result['added_buckets'] == '':
#module.fail_json(msg='No users or buckets were added successfully' , **result)
result['changed'] = False
# EXIT
module.exit_json(**result)

if __name__ == '__main__':
main()
```

Contributor guide

Open the contributing guide

Research direction

Open ceph_add_users_buckets.py and inspect the main function around the conditional state check and module.fail_json call. Preserve the result and finish through module.exit_json; done means existing users or buckets no longer cause an error and the result reports changed as false.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, python
Domain
devops
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.