mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Add optional input check to postgresql_ext (#282)
* Add optional input check to postgresql_ext Have added a new trust_input check to the postgresql_ext module that allows for checking the input that is passed to the module. * Add changelog fragment * Update tests/integration/targets/postgresql_ext/tasks/postgresql_ext_initial.yml Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
177314321b
commit
6c1c1604fb
5 changed files with 76 additions and 0 deletions
|
@ -80,6 +80,11 @@ options:
|
|||
When version downgrade is needed, remove the extension and create new one with appropriate version.
|
||||
- Set I(version=latest) to update the extension to the latest available version.
|
||||
type: str
|
||||
trust_input:
|
||||
description:
|
||||
- If C(no), check whether values of some parameters are potentially dangerous.
|
||||
type: bool
|
||||
default: yes
|
||||
seealso:
|
||||
- name: PostgreSQL extensions
|
||||
description: General information about PostgreSQL extensions.
|
||||
|
@ -175,6 +180,9 @@ except ImportError:
|
|||
pass
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils.database import (
|
||||
check_input,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.module_utils.postgres import (
|
||||
connect_to_db,
|
||||
get_conn_params,
|
||||
|
@ -309,6 +317,7 @@ def main():
|
|||
cascade=dict(type="bool", default=False),
|
||||
session_role=dict(type="str"),
|
||||
version=dict(type="str"),
|
||||
trust_input=dict(type="bool", default=True),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -321,8 +330,13 @@ def main():
|
|||
state = module.params["state"]
|
||||
cascade = module.params["cascade"]
|
||||
version = module.params["version"]
|
||||
session_role = module.params["session_role"]
|
||||
trust_input = module.params["trust_input"]
|
||||
changed = False
|
||||
|
||||
if not trust_input:
|
||||
check_input(module, ext, schema, version, session_role)
|
||||
|
||||
if version and state == 'absent':
|
||||
module.warn("Parameter version is ignored when state=absent")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue