postgresql modules: fix sanity issues (#67046)

* postgresql modules: fix sanity issues

* add changelog

* fix changelog
This commit is contained in:
Andrew Klychkov 2020-02-06 18:05:42 +03:00 committed by GitHub
parent a5b5101e09
commit 637eed5a5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 29 additions and 49 deletions

View file

@ -0,0 +1,4 @@
bugfixes:
- postgresql_membership - make the ``groups`` and ``target_roles`` parameters required (https://github.com/ansible/ansible/pull/67046).
- postgresql_slot - make the ``name`` parameter required (https://github.com/ansible/ansible/pull/67046).
- postgresql_tablespace - make the ``tablespace`` parameter required (https://github.com/ansible/ansible/pull/67046).

View file

@ -334,7 +334,7 @@ def main():
copy_from=dict(type='path', aliases=['from']),
src=dict(type='str', aliases=['source']),
dst=dict(type='str', aliases=['destination']),
columns=dict(type='list', aliases=['column']),
columns=dict(type='list', elements='str', aliases=['column']),
options=dict(type='dict'),
program=dict(type='bool', default=False),
db=dict(type='str', aliases=['login_db']),

View file

@ -59,7 +59,6 @@ options:
- Table to create index on it.
- Mutually exclusive with I(state=absent).
type: str
required: true
columns:
description:
- List of index columns that need to be covered by index.
@ -469,11 +468,11 @@ def main():
unique=dict(type='bool', default=False),
table=dict(type='str'),
idxtype=dict(type='str', aliases=['type']),
columns=dict(type='list', aliases=['column']),
columns=dict(type='list', elements='str', aliases=['column']),
cond=dict(type='str'),
session_role=dict(type='str'),
tablespace=dict(type='str'),
storage_params=dict(type='list'),
storage_params=dict(type='list', elements='str'),
cascade=dict(type='bool', default=False),
schema=dict(type='str'),
)

View file

@ -906,7 +906,7 @@ def main():
argument_spec = postgres_common_argument_spec()
argument_spec.update(
db=dict(type='str', aliases=['login_db']),
filter=dict(type='list'),
filter=dict(type='list', elements='str'),
session_role=dict(type='str'),
)
module = AnsibleModule(

View file

@ -50,6 +50,7 @@ options:
type: str
aliases:
- login_db
required: true
force_trust:
description:
- Marks the language as trusted, even if it's marked as untrusted in pg_pltemplate.

View file

@ -156,8 +156,8 @@ from ansible.module_utils.postgres import (
def main():
argument_spec = postgres_common_argument_spec()
argument_spec.update(
groups=dict(type='list', aliases=['group', 'source_role', 'source_roles']),
target_roles=dict(type='list', aliases=['target_role', 'user', 'users']),
groups=dict(type='list', elements='str', required=True, aliases=['group', 'source_role', 'source_roles']),
target_roles=dict(type='list', elements='str', required=True, aliases=['target_role', 'user', 'users']),
fail_on_role=dict(type='bool', default=True),
state=dict(type='str', default='present', choices=['absent', 'present']),
db=dict(type='str', aliases=['login_db']),

View file

@ -38,7 +38,6 @@ options:
- Type of a database object.
- Mutually exclusive with I(reassign_owned_by).
type: str
required: yes
choices: [ database, function, matview, sequence, schema, table, tablespace, view ]
aliases:
- type
@ -388,7 +387,7 @@ def main():
obj_name=dict(type='str'),
obj_type=dict(type='str', aliases=['type'], choices=[
'database', 'function', 'matview', 'sequence', 'schema', 'table', 'tablespace', 'view']),
reassign_owned_by=dict(type='list'),
reassign_owned_by=dict(type='list', elements='str'),
fail_on_role=dict(type='bool', default=True),
db=dict(type='str', aliases=['login_db']),
session_role=dict(type='str'),

View file

@ -86,16 +86,19 @@ options:
s=source, d=databases, u=users.
This option is deprecated since 2.9 and will be removed in 2.11.
Sortorder is now hardcoded to sdu.
type: str
default: sdu
choices: [ sdu, sud, dsu, dus, usd, uds ]
state:
description:
- The lines will be added/modified when C(state=present) and removed when C(state=absent).
type: str
default: present
choices: [ absent, present ]
users:
description:
- Users this line applies to.
type: str
default: all
notes:
@ -737,7 +740,7 @@ def main():
if pg_hba.last_backup:
ret['backup_file'] = pg_hba.last_backup
ret['pg_hba'] = [rule for rule in pg_hba.get_rules()]
ret['pg_hba'] = list(pg_hba.get_rules())
module.exit_json(**ret)

View file

@ -576,7 +576,7 @@ def main():
name=dict(required=True),
db=dict(type='str', aliases=['login_db']),
state=dict(type='str', default='present', choices=['absent', 'present']),
tables=dict(type='list'),
tables=dict(type='list', elements='str'),
parameters=dict(type='dict'),
owner=dict(type='str'),
cascade=dict(type='bool', default=False),

View file

@ -36,6 +36,7 @@ options:
When the value is a list, it will be converted to PostgreSQL array.
- Mutually exclusive with I(named_args).
type: list
elements: raw
named_args:
description:
- Dictionary of key-value arguments to pass to the query.
@ -242,7 +243,7 @@ def main():
argument_spec.update(
query=dict(type='str'),
db=dict(type='str', aliases=['login_db']),
positional_args=dict(type='list'),
positional_args=dict(type='list', elements='raw'),
named_args=dict(type='dict'),
session_role=dict(type='str'),
path_to_script=dict(type='path'),

View file

@ -42,7 +42,6 @@ options:
reload the server configuration you must pass I(value=default).
With I(value=default) the playbook always returns changed is true.
type: str
required: true
reset:
description:
- Restore parameter to initial state (boot_val). Mutually exclusive with I(value).

View file

@ -222,7 +222,7 @@ def main():
argument_spec = postgres_common_argument_spec()
argument_spec.update(
db=dict(type="str", aliases=["login_db"]),
name=dict(type="str", aliases=["slot_name"]),
name=dict(type="str", required=True, aliases=["slot_name"]),
slot_type=dict(type="str", default="physical", choices=["logical", "physical"]),
immediately_reserve=dict(type="bool", default=False),
session_role=dict(type="str"),

View file

@ -66,6 +66,7 @@ options:
- The publication names on the publisher to use for the subscription.
- Ignored when I(state) is not C(present).
type: list
elements: str
connparams:
description:
- The connection dict param-value to connect to the publisher.
@ -612,10 +613,10 @@ class PgSubscription():
def main():
argument_spec = postgres_common_argument_spec()
argument_spec.update(
name=dict(required=True),
db=dict(type='str', aliases=['login_db']),
name=dict(type='str', required=True),
db=dict(type='str', required=True, aliases=['login_db']),
state=dict(type='str', default='present', choices=['absent', 'present', 'refresh', 'stat']),
publications=dict(type='list'),
publications=dict(type='list', elements='str'),
connparams=dict(type='dict'),
cascade=dict(type='bool', default=False),
owner=dict(type='str'),

View file

@ -473,8 +473,8 @@ def main():
including=dict(type='str'),
rename=dict(type='str'),
truncate=dict(type='bool', default=False),
columns=dict(type='list'),
storage_params=dict(type='list'),
columns=dict(type='list', elements='str'),
storage_params=dict(type='list', elements='str'),
session_role=dict(type='str'),
cascade=dict(type='bool', default=False),
)

View file

@ -62,6 +62,7 @@ options:
description:
- New name of the tablespace.
- The new name cannot begin with pg_, as such names are reserved for system tablespaces.
type: str
session_role:
description:
- Switch to session_role after connecting. The specified session_role must
@ -378,7 +379,7 @@ class PgTablespace(object):
def main():
argument_spec = postgres_common_argument_spec()
argument_spec.update(
tablespace=dict(type='str', aliases=['name']),
tablespace=dict(type='str', required=True, aliases=['name']),
state=dict(type='str', default="present", choices=["absent", "present"]),
location=dict(type='path', aliases=['path']),
owner=dict(type='str'),

View file

@ -818,7 +818,7 @@ def main():
expires=dict(type='str', default=None),
conn_limit=dict(type='int', default=None),
session_role=dict(type='str'),
groups=dict(type='list'),
groups=dict(type='list', elements='str'),
comment=dict(type='str', default=None),
)
module = AnsibleModule(

View file

@ -2489,38 +2489,10 @@ lib/ansible/modules/database/mysql/mysql_info.py validate-modules:parameter-list
lib/ansible/modules/database/mysql/mysql_query.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/mysql/mysql_user.py validate-modules:undocumented-parameter
lib/ansible/modules/database/mysql/mysql_variables.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_copy.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_copy.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_db.py use-argspec-type-path
lib/ansible/modules/database/postgresql/postgresql_db.py validate-modules:use-run-command-not-popen
lib/ansible/modules/database/postgresql/postgresql_idx.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_idx.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_idx.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_info.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_info.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_lang.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_membership.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_membership.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_membership.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_owner.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_owner.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_owner.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_pg_hba.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/postgresql/postgresql_privs.py validate-modules:parameter-documented-multiple-times
lib/ansible/modules/database/postgresql/postgresql_publication.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_publication.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_query.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_set.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_slot.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_subscription.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_subscription.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_table.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_table.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/postgresql/postgresql_tablespace.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/postgresql/postgresql_tablespace.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/postgresql/postgresql_user.py validate-modules:doc-choices-do-not-match-spec
lib/ansible/modules/database/postgresql/postgresql_user.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/postgresql/postgresql_user.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/proxysql/proxysql_backend_servers.py validate-modules:doc-missing-type
lib/ansible/modules/database/proxysql/proxysql_backend_servers.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/proxysql/proxysql_backend_servers.py validate-modules:undocumented-parameter