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

postgresql_privs: Support FOREIGN DATA WRAPPER and FOREIGN SERVER #38803

Conversation

lichensky
Copy link
Contributor

SUMMARY

This introduces support for FOREIGN DATA WRAPPER and FOREIGN SERVER as object types in postgresql_privs module.

Issues:
#38801

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

postgresql_privs

ANSIBLE VERSION
ansible 2.6.0
  config file = /etc/ansible/ansible.cfg
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]

@ansibot
Copy link
Contributor

ansibot commented Apr 16, 2018

@ansibot ansibot added community_review In order to be merged, this PR must follow the community 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:community This issue/PR relates to code supported by the Ansible community. labels Apr 16, 2018
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Apr 16, 2018
Copy link
Member

@Akasurde Akasurde left a comment

Choose a reason for hiding this comment

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

Rest LGTM, need one more person to take a look.

@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 17, 2018
@Akasurde
Copy link
Member

Akasurde commented Apr 17, 2018

Thanks. We need one more person to look at this and then we can proceed.

@Akasurde
Copy link
Member

cc @maveric-tellrv Would you like to review this PR ?

@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 17, 2018
@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 Apr 25, 2018
@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 19, 2018
@ansibot ansibot added 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. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Aug 7, 2018
@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels Sep 16, 2018
@ansibot ansibot added support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 2, 2018
@dagwieers dagwieers added the postgresql PostgreSQL community label Feb 1, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 9, 2019

@dagwieers dagwieers added the database Database category label Feb 13, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 13, 2019

@lichensky lichensky force-pushed the feature/postgresql_privs_fdw_and_fs_obj_types branch from 30977cf to f8449cd Compare March 1, 2019 16:18
@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 stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 1, 2019
@lichensky
Copy link
Contributor Author

@Andersson007 Hi, conflicts resolved.

Copy link
Contributor

@Andersson007 Andersson007 left a comment

Choose a reason for hiding this comment

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

LGTM,
a couple of notices:

  1. Add examples with new types to EXAMPLE block.
    use the following example's form, (not as the existing examples):
- name: ....
  postgresql_privs:
    ...
  1. To be sure that it won't brake down, would be better to add CI tests (for 'foreign_data_wrapper' type only is enough) to a new file like
    test/integration/targets/postgresql/tasks/postgresql_privs.yml and include it to main.yml in the same dir.
    You can use for example test/integration/targets/postgresql/tasks/postgresql_query.yml from the current dev branch.
  2. Add the note about 2.8 as Akasurde said in April.

@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 Mar 4, 2019
@lichensky lichensky force-pushed the feature/postgresql_privs_fdw_and_fs_obj_types branch from 3e42652 to f85b55a Compare March 6, 2019 20:35
@lichensky
Copy link
Contributor Author

Thanks for checking it out. I've added integration tests and mentioned changes.

@ansibot ansibot added the test This PR relates to tests. label Mar 6, 2019
privs: ALL
objs: dummy
db: "{{ db_name }}"
login_user: "{{ pg_user }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should check here at least that changed == true when we grant these privs

Suggested change
login_user: "{{ pg_user }}"
login_user: "{{ pg_user }}"
register: result
ignore_errors: yes
- assert:
that:
- result.changed == true

privs: ALL
objs: dummy_server
db: "{{ db_name }}"
login_user: "{{ pg_user }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
login_user: "{{ pg_user }}"
login_user: "{{ pg_user }}"
register: result
ignore_errors: yes
- assert:
that:
- result.changed == true

I think we should check here at least that changed == true when we grant these privs too because maybe this actually won't return changed == true. We can't be sure if we don't check

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, to make your test complete:

  1. try to grant both privs again and check that changed == false
  2. try to drop both privs and check that changed == true
  3. try to drop both privs again and check that changed == false

@Andersson007
Copy link
Contributor

Andersson007 commented Mar 7, 2019

@lichensky lichensky force-pushed the feature/postgresql_privs_fdw_and_fs_obj_types branch from f85b55a to c826d78 Compare March 7, 2019 20:10
@lichensky lichensky force-pushed the feature/postgresql_privs_fdw_and_fs_obj_types branch 2 times, most recently from 043e8ed to 6842299 Compare March 8, 2019 07:37
@lichensky
Copy link
Contributor Author

Done

Copy link
Contributor

@Andersson007 Andersson007 left a comment

Choose a reason for hiding this comment

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

shipit

@Andersson007
Copy link
Contributor

@Akasurde , seems 2 shipits. Ready for merge

@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 Mar 8, 2019
@Akasurde Akasurde merged commit 6e19848 into ansible:devel Mar 8, 2019
@Andersson007
Copy link
Contributor

Andersson007 commented Mar 8, 2019

@lichensky , @Akasurde , thank you, good job!
@lichensky , We have several tasks and new modules https://github.com/ansible/community/wiki/PostgreSQL. Would be better if you look at one, e.g. postgresql_tables. I think this module will be quite useful.
You can write yourself in the group as a member. Welcome!
Also you can find there some ideas to implement.

@Andersson007
Copy link
Contributor

If you have any questions, you may ask me directly by aaklychkov at mail dot ru

@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.6 This issue/PR affects Ansible v2.6 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. postgresql PostgreSQL community support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants