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

deprecate groups argument #295

Merged
merged 2 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
major_changes:
- postgresql_user - the ``groups`` argument has been deprecated and will be removed in ``community.postgresql 3.0.0``. Please use the ``postgresql_membership`` module to specify group/role memberships instead (https://github.com/ansible-collections/community.postgresql/issues/277).
13 changes: 12 additions & 1 deletion plugins/modules/postgresql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
whether the user has been removed or not.
- B(WARNING) The I(priv) option has been B(deprecated) and will be removed in community.postgresql 3.0.0. Please use the
M(community.postgresql.postgresql_privs) module instead.
- B(WARNING) The I(groups) option has been B(deprecated) ans will be removed in community.postgresql 3.0.0.
Please use the M(community.postgresql.postgresql_membership) module instead.
options:
name:
description:
Expand Down Expand Up @@ -139,6 +141,9 @@
aliases: [ ssl_rootcert ]
groups:
description:
- This option has been B(deprecated) and will be removed in community.postgresql 3.0.0.
Please use the I(postgresql_membership) module to GRANT/REVOKE group/role memberships
instead.
- The list of groups (roles) that you want to grant to the user.
type: list
elements: str
Expand Down Expand Up @@ -244,6 +249,8 @@
user: test
password: ""

# This example uses the `group` argument which is deprecated.
# You should use the `postgresql_membership` module instead.
- name: Create user test and grant group user_ro and user_rw to it
community.postgresql.postgresql_user:
name: test
Expand Down Expand Up @@ -917,7 +924,8 @@ def main():
expires=dict(type='str', default=None),
conn_limit=dict(type='int', default=None),
session_role=dict(type='str'),
groups=dict(type='list', elements='str'),
# WARNING: groups are deprecated and will be removed in community.postgresql 3.0.0
groups=dict(type='list', elements='str', removed_in_version='3.0.0', removed_from_collection='community.postgreql'),
comment=dict(type='str', default=None),
trust_input=dict(type='bool', default=True),
)
Expand All @@ -943,6 +951,7 @@ def main():
expires = module.params["expires"]
conn_limit = module.params["conn_limit"]
role_attr_flags = module.params["role_attr_flags"]
# WARNING: groups are deprecated and will be removed in community.postgresql 3.0.0
groups = module.params["groups"]
if groups:
groups = [e.strip() for e in groups]
Expand All @@ -952,6 +961,7 @@ def main():
trust_input = module.params['trust_input']
if not trust_input:
# Check input for potentially dangerous elements:
# WARNING: groups are deprecated and will be removed in community.postgresql 3.0.0
check_input(module, user, password, privs, expires,
role_attr_flags, groups, comment, session_role)

Expand Down Expand Up @@ -995,6 +1005,7 @@ def main():
except SQLParseError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())

# WARNING: groups are deprecated and will be removed in community.postgresql 3.0.0
if groups:
target_roles = []
target_roles.append(user)
Expand Down