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

[backport/2.2] Fix validation errors in plugin documentation (#399) #458

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
4 changes: 2 additions & 2 deletions plugins/connection/kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

DOCUMENTATION = r"""
author:
- xuxinkun
- xuxinkun (@xuxinkun)

connection: kubectl
name: kubectl

short_description: Execute tasks in pods running on Kubernetes.

Expand Down
5 changes: 2 additions & 3 deletions plugins/inventory/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

DOCUMENTATION = '''
name: k8s
plugin_type: inventory
author:
- Chris Houseknecht <@chouseknecht>
- Fabian von Feilitzsch <@fabianvf>
- Chris Houseknecht (@chouseknecht)
- Fabian von Feilitzsch (@fabianvf)

short_description: Kubernetes (K8s) inventory source

Expand Down
45 changes: 18 additions & 27 deletions plugins/lookup/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

__metaclass__ = type

DOCUMENTATION = '''
lookup: k8s
DOCUMENTATION = """
name: k8s

short_description: Query the K8s API

author:
- Chris Houseknecht <@chouseknecht>
- Fabian von Feilitzsch <@fabianvf>
- Chris Houseknecht (@chouseknecht)
- Fabian von Feilitzsch (@fabianvf)

description:
- Uses the Kubernetes Python client to fetch a specific object by name, all matching objects within a
Expand Down Expand Up @@ -117,7 +117,7 @@
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
'''
"""

EXAMPLES = """
- name: Fetch a list of namespaces
Expand Down Expand Up @@ -159,28 +159,19 @@
_list:
description:
- One ore more object definitions returned from the API.
type: complex
contains:
api_version:
description: The versioned schema of this representation of an object.
returned: success
type: str
kind:
description: Represents the REST resource this object represents.
returned: success
type: str
metadata:
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
returned: success
type: complex
spec:
description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
returned: success
type: complex
status:
description: Current status details for the object.
returned: success
type: complex
type: list
elements: dict
sample:
- kind: ConfigMap
apiVersion: v1
metadata:
creationTimestamp: "2022-03-04T13:59:49Z"
name: my-config-map
namespace: default
resourceVersion: "418"
uid: 5714b011-d090-4eac-8272-a0ea82ec0abd
data:
key1: val1
"""

from ansible.errors import AnsibleError
Expand Down
39 changes: 13 additions & 26 deletions plugins/lookup/kustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

DOCUMENTATION = '''
lookup: kustomize
DOCUMENTATION = """
name: kustomize

short_description: Build a set of kubernetes resources using a 'kustomization.yaml' file.

version_added: "2.2.0"

author:
- Aubin Bikouo <@abikouo>
- Aubin Bikouo (@abikouo)
notes:
- If both kustomize and kubectl are part of the PATH, kustomize will be used by the plugin.
description:
Expand All @@ -33,7 +33,7 @@

requirements:
- "python >= 3.6"
'''
"""

EXAMPLES = """
- name: Run lookup using kustomize
Expand All @@ -52,29 +52,16 @@
RETURN = """
_list:
description:
- One ore more object definitions returned from the tool execution.
type: complex
contains:
api_version:
description: The versioned schema of this representation of an object.
returned: success
type: str
kind:
description: Represents the REST resource this object represents.
returned: success
type: str
- YAML string for the object definitions returned from the tool execution.
type: str
sample:
kind: ConfigMap
apiVersion: v1
metadata:
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
returned: success
type: complex
spec:
description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
returned: success
type: complex
status:
description: Current status details for the object.
returned: success
type: complex
name: my-config-map
namespace: default
data:
key1: val1
"""

from ansible.errors import AnsibleLookupError
Expand Down