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

Add grants to influxdb_user #46216

Merged
merged 2 commits into from
Apr 9, 2019
Merged

Conversation

aperrin66
Copy link
Contributor

SUMMARY
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

influxdb_user

ANSIBLE VERSION
2.6.4
ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Sep 27, 2018

cc @kamsz
click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 27, 2018
@ansibot
Copy link
Contributor

ansibot commented Sep 27, 2018

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

lib/ansible/modules/database/influxdb/influxdb_user.py:153:16: E713 test for membership should be 'not in'
lib/ansible/modules/database/influxdb/influxdb_user.py:162:16: E713 test for membership should be 'not in'
lib/ansible/modules/database/influxdb/influxdb_user.py:174:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/database/influxdb/influxdb_user.py:0:0: E322 "grants" is listed in the argument_spec, but not documented in the module

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Sep 27, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Sep 27, 2018
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Sep 28, 2018
@ansibot
Copy link
Contributor

ansibot commented Sep 28, 2018

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

lib/ansible/modules/database/influxdb/influxdb_user.py:170:16: E713 test for membership should be 'not in'
lib/ansible/modules/database/influxdb/influxdb_user.py:179:16: E713 test for membership should be 'not in'
lib/ansible/modules/database/influxdb/influxdb_user.py:191:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/database/influxdb/influxdb_user.py:0:0: E309 version_added for new option (grants) should be 2.8. Currently 0.0

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Sep 28, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Sep 28, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. and removed core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 6, 2018
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 25, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jan 4, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jan 12, 2019
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Feb 7, 2019
@ansibot ansibot added database Database category stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Feb 15, 2019
@aperrin66 aperrin66 force-pushed the add-grants-to-influxdb_user branch 2 times, most recently from 8d06cf0 to 58ed8dc Compare April 8, 2019 15:24
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 8, 2019
Copy link
Contributor

@resmo resmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs_revision

def main():
argument_spec = influx.InfluxDb.influxdb_argument_spec()
argument_spec.update(
state=dict(default='present', type='str', choices=['present', 'absent']),
user_name=dict(required=True, type='str'),
user_password=dict(required=False, type='str', no_log=True),
admin=dict(default='False', type='bool')
admin=dict(default='False', type='bool'),
grants=dict(default=[], type='list')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to None:

grants=dict(type='list')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done, thanks

else:
user_password = user_password or ''
create_user(module, client, user_name, user_password, admin)
changed = True

if grants:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default to an empty list may result in a unexpected behaviour, if users don't use this param (default empty list) and have set grants manually, the grants would get deleted with this implementation.

I would change it in a way to only handle it if a list (be it empty) is set and ignore it if None (param unset):

        if grants is not None:
            if set_user_grants(module, client, user_name, grants):
                changed = True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done, thanks

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Apr 8, 2019
@aperrin66 aperrin66 force-pushed the add-grants-to-influxdb_user branch from 58ed8dc to 4d5cf32 Compare April 9, 2019 08:26
@aperrin66 aperrin66 force-pushed the add-grants-to-influxdb_user branch from 4d5cf32 to ad15106 Compare April 9, 2019 08:30
Copy link
Contributor

@resmo resmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipit

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Apr 9, 2019
@resmo resmo merged commit 6eedc4d into ansible:devel Apr 9, 2019
@aperrin66 aperrin66 deleted the add-grants-to-influxdb_user branch April 10, 2019 07:22
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 community_review In order to be merged, this PR must follow the community review workflow. database Database category feature This issue/PR relates to a feature request. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

influxdb_user does not support setting privileges
7 participants