1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix various sanity errors in plugins (#881) (#893)

* Fix deprecation of callables.

* Fix various sanity errors.

* Revert callback_type -> type transform.

* Fix stat_result times: these are float according to https://github.com/python/typeshed/blob/master/stdlib/3/os/__init__.pyi

* Apply suggestions from code review

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
(cherry picked from commit 7cf472855c)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2020-09-17 16:39:57 +00:00 committed by GitHub
parent 1dfd6e395c
commit c802de865a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 88 additions and 27 deletions

View file

@ -740,3 +740,16 @@ plugin_routing:
removal_version: 2.0.0 removal_version: 2.0.0
warning_text: The mysql module_utils has been moved to the community.mysql collection. warning_text: The mysql module_utils has been moved to the community.mysql collection.
redirect: community.mysql.mysql redirect: community.mysql.mysql
callback:
actionable:
deprecation:
removal_version: 2.0.0
warning_text: see plugin documentation for details
full_skip:
deprecation:
removal_version: 2.0.0
warning_text: see plugin documentation for details
stderr:
deprecation:
removal_version: 2.0.0
warning_text: see plugin documentation for details

View file

@ -14,7 +14,7 @@ DOCUMENTATION = '''
become_user: become_user:
description: description:
- User you 'become' to execute the task - User you 'become' to execute the task
- This plugin ignores this setting as pfexec uses it's own ``exec_attr`` to figure this out, - This plugin ignores this setting as pfexec uses it's own C(exec_attr) to figure this out,
but it is supplied here for Ansible to make decisions needed for the task execution, like file permissions. but it is supplied here for Ansible to make decisions needed for the task execution, like file permissions.
default: root default: root
ini: ini:
@ -80,8 +80,8 @@ DOCUMENTATION = '''
- name: ansible_pfexec_wrap_execution - name: ansible_pfexec_wrap_execution
env: env:
- name: ANSIBLE_PFEXEC_WRAP_EXECUTION - name: ANSIBLE_PFEXEC_WRAP_EXECUTION
note: notes:
- This plugin ignores ``become_user`` as pfexec uses it's own ``exec_attr`` to figure this out. - This plugin ignores I(become_user) as pfexec uses it's own C(exec_attr) to figure this out.
''' '''
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase

View file

@ -6,11 +6,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.playbook.task_include import TaskInclude
DOCUMENTATION = ''' DOCUMENTATION = '''
callback: counter_enabled callback: counter_enabled
@ -26,6 +21,12 @@ DOCUMENTATION = '''
- set as stdout callback in ansible.cfg (stdout_callback = counter_enabled) - set as stdout callback in ansible.cfg (stdout_callback = counter_enabled)
''' '''
from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.playbook.task_include import TaskInclude
class CallbackModule(CallbackBase): class CallbackModule(CallbackBase):

View file

@ -52,7 +52,7 @@ options:
ini: ini:
- section: callback_mail - section: callback_mail
key: bcc key: bcc
note: notes:
- "TODO: expand configuration options now that plugins can leverage Ansible's configuration" - "TODO: expand configuration options now that plugins can leverage Ansible's configuration"
''' '''

View file

@ -10,8 +10,8 @@ __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = '''
name: gitlab_runners name: gitlab_runners
plugin_type: inventory plugin_type: inventory
authors: author:
- Stefan Heitmüller (stefan.heitmueller@gmx.com) - Stefan Heitmüller (@morph027) <stefan.heitmueller@gmx.com>
short_description: Ansible dynamic inventory plugin for GitLab runners. short_description: Ansible dynamic inventory plugin for GitLab runners.
requirements: requirements:
- python >= 2.7 - python >= 2.7

View file

@ -34,7 +34,9 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: description:
- The value from the databag - The value from the databag.
type: list
elements: dict
""" """
from ansible.errors import AnsibleError from ansible.errors import AnsibleError

View file

@ -98,6 +98,7 @@ RETURN = """
_raw: _raw:
description: description:
- Value(s) stored in consul. - Value(s) stored in consul.
type: dict
""" """
import os import os

View file

@ -78,7 +78,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: description:
- value(s) stored in Credstash - Value(s) stored in Credstash.
type: str
""" """
import os import os

View file

@ -30,8 +30,8 @@ DOCUMENTATION = '''
default: 'password' default: 'password'
_extra: _extra:
description: for extra_params values please check parameters for clipasswordsdk in CyberArk's "Credential Provider and ASCP Implementation Guide" description: for extra_params values please check parameters for clipasswordsdk in CyberArk's "Credential Provider and ASCP Implementation Guide"
note: notes:
- For Ansible on windows, please change the -parameters (-p, -d, and -o) to /parameters (/p, /d, and /o) and change the location of CLIPasswordSDK.exe - For Ansible on Windows, please change the -parameters (-p, -d, and -o) to /parameters (/p, /d, and /o) and change the location of CLIPasswordSDK.exe.
''' '''
EXAMPLES = """ EXAMPLES = """

View file

@ -77,8 +77,10 @@ EXAMPLES = """
RETURN = """ RETURN = """
_list: _list:
description: description:
- list of composed strings or dictionaries with key and value - List of composed strings or dictionaries with key and value
If a dictionary, fields shows the keys returned depending on query type If a dictionary, fields shows the keys returned depending on query type
type: list
elements: raw
contains: contains:
ALL: ALL:
description: description:

View file

@ -70,6 +70,8 @@ _list:
description: description:
- One or more JSON responses to C(GET /secrets/{path}). - One or more JSON responses to C(GET /secrets/{path}).
- See U(https://dsv.thycotic.com/api/index.html#operation/getSecret). - See U(https://dsv.thycotic.com/api/index.html#operation/getSecret).
type: list
elements: dict
""" """
EXAMPLES = r""" EXAMPLES = r"""

View file

@ -94,6 +94,7 @@ DOCUMENTATION = '''
seealso: seealso:
- module: community.general.etcd3 - module: community.general.etcd3
- ref: etcd_lookup - ref: etcd_lookup
description: The etcd v2 lookup.
requirements: requirements:
- "etcd3 >= 0.10" - "etcd3 >= 0.10"

View file

@ -53,42 +53,60 @@ EXAMPLES = r"""
RETURN = r""" RETURN = r"""
_raw: _raw:
description: list of dictionaries with file information description: List of dictionaries with file information.
type: list
elements: dict
contains: contains:
src: src:
description: description:
- full path to file. - Full path to file.
- not returned when C(item.state) is set to C(directory). - Not returned when I(item.state) is set to C(directory).
type: path
root: root:
description: allows filtering by original location. description: Allows filtering by original location.
type: path
path: path:
description: contains the relative path to root. description: Contains the relative path to root.
type: path
mode: mode:
description: The permissions the resulting file or directory. description: The permissions the resulting file or directory.
type: str
state: state:
description: TODO description: TODO
type: str
owner: owner:
description: Name of the user that owns the file/directory. description: Name of the user that owns the file/directory.
type: raw
group: group:
description: Name of the group that owns the file/directory. description: Name of the group that owns the file/directory.
type: raw
seuser: seuser:
description: The user part of the SELinux file context. description: The user part of the SELinux file context.
type: raw
serole: serole:
description: The role part of the SELinux file context. description: The role part of the SELinux file context.
type: raw
setype: setype:
description: The type part of the SELinux file context. description: The type part of the SELinux file context.
type: raw
selevel: selevel:
description: The level part of the SELinux file context. description: The level part of the SELinux file context.
type: raw
uid: uid:
description: Owner ID of the file/directory. description: Owner ID of the file/directory.
type: int
gid: gid:
description: Group ID of the file/directory. description: Group ID of the file/directory.
type: int
size: size:
description: Size of the target. description: Size of the target.
type: int
mtime: mtime:
description: Time of last modification. description: Time of last modification.
type: float
ctime: ctime:
description: Time of last metadata update or creation (depends on OS). description: Time of last metadata update or creation (depends on OS).
type: float
""" """
import os import os
import pwd import pwd

View file

@ -40,6 +40,8 @@ RETURN = '''
_raw: _raw:
description: description:
- base64 encoded file content - base64 encoded file content
type: list
elements: str
''' '''
import base64 import base64

View file

@ -241,6 +241,8 @@ RETURN = """
_raw: _raw:
description: description:
- secrets(s) requested - secrets(s) requested
type: list
elements: dict
""" """
import os import os

View file

@ -18,7 +18,7 @@ DOCUMENTATION = '''
description: description:
- The list of keys to lookup on the Puppetmaster - The list of keys to lookup on the Puppetmaster
type: list type: list
element_type: string elements: string
required: True required: True
_bin_file: _bin_file:
description: description:
@ -55,7 +55,8 @@ RETURN = """
_raw: _raw:
description: description:
- a value associated with input key - a value associated with input key
type: strings type: list
elements: str
""" """
import os import os

View file

@ -29,7 +29,9 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: secrets stored description: Secrets stored.
type: list
elements: str
""" """
HAS_KEYRING = True HAS_KEYRING = True

View file

@ -32,6 +32,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: secrets stored description: secrets stored
type: list
elements: str
""" """
from subprocess import Popen, PIPE from subprocess import Popen, PIPE

View file

@ -48,6 +48,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: value(s) stored in LMDB description: value(s) stored in LMDB
type: list
elements: raw
""" """

View file

@ -83,7 +83,6 @@ RETURN = """
obj_type: obj_type:
description: description:
- The object type specified in the terms argument - The object type specified in the terms argument
returned: always
type: complex type: complex
contains: contains:
obj_field: obj_field:

View file

@ -64,7 +64,6 @@ RETURN = """
_list: _list:
description: description:
- The list of next IP addresses available - The list of next IP addresses available
returned: always
type: list type: list
""" """

View file

@ -74,7 +74,6 @@ RETURN = """
_list: _list:
description: description:
- The list of next network addresses available - The list of next network addresses available
returned: always
type: list type: list
""" """

View file

@ -86,6 +86,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: field data requested description: field data requested
type: list
elements: str
""" """
import errno import errno

View file

@ -62,6 +62,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: field data requested description: field data requested
type: list
elements: dict
""" """
import json import json

View file

@ -91,6 +91,8 @@ RETURN = """
_raw: _raw:
description: description:
- a password - a password
type: list
elements: str
""" """
import os import os

View file

@ -67,6 +67,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_raw: _raw:
description: value(s) stored in Redis description: value(s) stored in Redis
type: list
elements: str
""" """
import os import os

View file

@ -29,6 +29,8 @@ EXAMPLES = """
RETURN = """ RETURN = """
_list: _list:
description: value(s) of key(s) in shelve file(s) description: value(s) of key(s) in shelve file(s)
type: list
elements: str
""" """
import shelve import shelve

View file

@ -66,6 +66,8 @@ _list:
description: description:
- The JSON responses to C(GET /secrets/{id}). - The JSON responses to C(GET /secrets/{id}).
- See U(https://updates.thycotic.net/secretserver/restapiguide/TokenAuth/#operation--secrets--id--get). - See U(https://updates.thycotic.net/secretserver/restapiguide/TokenAuth/#operation--secrets--id--get).
type: list
elements: dict
""" """
EXAMPLES = r""" EXAMPLES = r"""