summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Klychkov <aaklychkov@mail.ru>2020-02-06 18:05:42 +0300
committerGitHub <noreply@github.com>2020-02-06 16:05:42 +0100
commit637eed5a5c3cff7e7d71faadc5de6e591e32d1d0 (patch)
tree845e10bfa8fa8c203e8461494dab4d2badade764
parenta5b5101e09a0b7617d697f493eb25630c73bf4e0 (diff)
downloadansible-637eed5a5c3cff7e7d71faadc5de6e591e32d1d0.tar.gz
postgresql modules: fix sanity issues (#67046)
* postgresql modules: fix sanity issues * add changelog * fix changelog
-rw-r--r--changelogs/fragments/67046-postgresql_modules_make_params_required.yml4
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_copy.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_idx.py5
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_info.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_lang.py1
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_membership.py4
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_owner.py3
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_pg_hba.py5
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_publication.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_query.py3
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_set.py1
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_slot.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_subscription.py7
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_table.py4
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_tablespace.py3
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_user.py2
-rw-r--r--test/sanity/ignore.txt28
17 files changed, 29 insertions, 49 deletions
diff --git a/changelogs/fragments/67046-postgresql_modules_make_params_required.yml b/changelogs/fragments/67046-postgresql_modules_make_params_required.yml
new file mode 100644
index 0000000000..b94af237aa
--- /dev/null
+++ b/changelogs/fragments/67046-postgresql_modules_make_params_required.yml
@@ -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).
diff --git a/lib/ansible/modules/database/postgresql/postgresql_copy.py b/lib/ansible/modules/database/postgresql/postgresql_copy.py
index 315920f8e1..9c5a3766fb 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_copy.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_copy.py
@@ -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']),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_idx.py b/lib/ansible/modules/database/postgresql/postgresql_idx.py
index bb0cd4999e..baf96e0ba3 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_idx.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_idx.py
@@ -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'),
)
diff --git a/lib/ansible/modules/database/postgresql/postgresql_info.py b/lib/ansible/modules/database/postgresql/postgresql_info.py
index 91daac62da..79e8d0dc52 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_info.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_info.py
@@ -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(
diff --git a/lib/ansible/modules/database/postgresql/postgresql_lang.py b/lib/ansible/modules/database/postgresql/postgresql_lang.py
index 083c751f5c..6c85b197ce 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_lang.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_lang.py
@@ -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.
diff --git a/lib/ansible/modules/database/postgresql/postgresql_membership.py b/lib/ansible/modules/database/postgresql/postgresql_membership.py
index b11e8e18cf..5d2ba25b5e 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_membership.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_membership.py
@@ -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']),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_owner.py b/lib/ansible/modules/database/postgresql/postgresql_owner.py
index d1edc332dd..943ed55da7 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_owner.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_owner.py
@@ -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'),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_pg_hba.py b/lib/ansible/modules/database/postgresql/postgresql_pg_hba.py
index aa410992bf..acfaa567e9 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_pg_hba.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_pg_hba.py
@@ -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)
diff --git a/lib/ansible/modules/database/postgresql/postgresql_publication.py b/lib/ansible/modules/database/postgresql/postgresql_publication.py
index 1676aca8df..863c6fc66d 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_publication.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_publication.py
@@ -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),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_query.py b/lib/ansible/modules/database/postgresql/postgresql_query.py
index 777af2719f..18d63e332a 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_query.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_query.py
@@ -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'),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_set.py b/lib/ansible/modules/database/postgresql/postgresql_set.py
index ba0bec5507..29ce1f2825 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_set.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_set.py
@@ -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).
diff --git a/lib/ansible/modules/database/postgresql/postgresql_slot.py b/lib/ansible/modules/database/postgresql/postgresql_slot.py
index ff6198e518..30aaf39458 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_slot.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_slot.py
@@ -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"),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_subscription.py b/lib/ansible/modules/database/postgresql/postgresql_subscription.py
index 20fbc8133f..f89382515e 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_subscription.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_subscription.py
@@ -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'),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_table.py b/lib/ansible/modules/database/postgresql/postgresql_table.py
index 02d5538db6..6bd556eb31 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_table.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_table.py
@@ -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),
)
diff --git a/lib/ansible/modules/database/postgresql/postgresql_tablespace.py b/lib/ansible/modules/database/postgresql/postgresql_tablespace.py
index f643c94151..aceced98af 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_tablespace.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_tablespace.py
@@ -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'),
diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py
index b7fdb7e7dc..10afd0a0d8 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_user.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_user.py
@@ -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(
diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt
index 566f451719..cfb927870d 100644
--- a/test/sanity/ignore.txt
+++ b/test/sanity/ignore.txt
@@ -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