Skip to content

Commit 299172d

Browse files
russozfelixfontein
andauthored
fixed hidden warnings from extra tests - batch 2 (#10027)
* fixed hidden warnings from extra tests - batch 2 * remove multiple yaml doc markers from EXAMPLE blocks * Apply suggestions from code review Co-authored-by: Felix Fontein <[email protected]> * Apply suggestions from code review * Apply suggestions from code review * dig: adjust markup for return suboptions * Update plugins/lookup/dig.py --------- Co-authored-by: Felix Fontein <[email protected]>
1 parent a042721 commit 299172d

36 files changed

+1950
-1960
lines changed

plugins/inventory/proxmox.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@
155155
token_id: gitlab-1
156156
token_secret: fa256e9c-26ab-41ec-82da-707a2c079829
157157
158+
---
158159
# The secret can also be a vault string or passed via the environment variable TOKEN_SECRET.
160+
plugin: community.general.proxmox
161+
user: ci@pve
162+
token_id: gitlab-1
159163
token_secret: !vault |
160164
$ANSIBLE_VAULT;1.1;AES256
161165
62353634333163633336343265623632626339313032653563653165313262343931643431656138
@@ -216,7 +220,6 @@
216220
# Note that this can easily give you wrong values as ansible_host. See further up for
217221
# an example where this is set to `false` and where ansible_host is set with `compose`.
218222
want_proxmox_nodes_ansible_host: true
219-
220223
'''
221224

222225
import itertools

plugins/inventory/xen_orchestra.py

Lines changed: 77 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,76 +5,81 @@
55

66
from __future__ import annotations
77

8-
DOCUMENTATION = '''
9-
name: xen_orchestra
10-
short_description: Xen Orchestra inventory source
11-
version_added: 4.1.0
12-
author:
13-
- Dom Del Nano (@ddelnano) <[email protected]>
14-
- Samori Gorse (@shinuza) <[email protected]>
15-
requirements:
16-
- websocket-client >= 1.0.0
8+
DOCUMENTATION = r"""
9+
name: xen_orchestra
10+
short_description: Xen Orchestra inventory source
11+
version_added: 4.1.0
12+
author:
13+
- Dom Del Nano (@ddelnano) <[email protected]>
14+
- Samori Gorse (@shinuza) <[email protected]>
15+
requirements:
16+
- websocket-client >= 1.0.0
17+
description:
18+
- Get inventory hosts from a Xen Orchestra deployment.
19+
- Uses a configuration file as an inventory source, it must end in C(.xen_orchestra.yml) or C(.xen_orchestra.yaml).
20+
extends_documentation_fragment:
21+
- constructed
22+
- inventory_cache
23+
options:
24+
plugin:
25+
description: The name of this plugin, it should always be set to V(community.general.xen_orchestra) for this plugin to
26+
recognize it as its own.
27+
required: true
28+
choices: ['community.general.xen_orchestra']
29+
type: str
30+
api_host:
1731
description:
18-
- Get inventory hosts from a Xen Orchestra deployment.
19-
- 'Uses a configuration file as an inventory source, it must end in C(.xen_orchestra.yml) or C(.xen_orchestra.yaml).'
20-
extends_documentation_fragment:
21-
- constructed
22-
- inventory_cache
23-
options:
24-
plugin:
25-
description: The name of this plugin, it should always be set to V(community.general.xen_orchestra) for this plugin to recognize it as its own.
26-
required: true
27-
choices: ['community.general.xen_orchestra']
28-
type: str
29-
api_host:
30-
description:
31-
- API host to XOA API.
32-
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_HOST) will be used instead.
33-
type: str
34-
env:
35-
- name: ANSIBLE_XO_HOST
36-
user:
37-
description:
38-
- Xen Orchestra user.
39-
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_USER) will be used instead.
40-
required: true
41-
type: str
42-
env:
43-
- name: ANSIBLE_XO_USER
44-
password:
45-
description:
46-
- Xen Orchestra password.
47-
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_PASSWORD) will be used instead.
48-
required: true
49-
type: str
50-
env:
51-
- name: ANSIBLE_XO_PASSWORD
52-
validate_certs:
53-
description: Verify TLS certificate if using HTTPS.
54-
type: boolean
55-
default: true
56-
use_ssl:
57-
description: Use wss when connecting to the Xen Orchestra API
58-
type: boolean
59-
default: true
60-
use_vm_uuid:
61-
description:
62-
- Import Xen VMs to inventory using their UUID as the VM entry name.
63-
- If set to V(false) use VM name labels instead of UUIDs.
64-
type: boolean
65-
default: true
66-
version_added: 10.4.0
67-
use_host_uuid:
68-
description:
69-
- Import Xen Hosts to inventory using their UUID as the Host entry name.
70-
- If set to V(false) use Host name labels instead of UUIDs.
71-
type: boolean
72-
default: true
73-
version_added: 10.4.0
74-
'''
75-
76-
77-
EXAMPLES = '''
32+
- API host to XOA API.
33+
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_HOST)
34+
will be used instead.
35+
type: str
36+
env:
37+
- name: ANSIBLE_XO_HOST
38+
user:
39+
description:
40+
- Xen Orchestra user.
41+
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_USER)
42+
will be used instead.
43+
required: true
44+
type: str
45+
env:
46+
- name: ANSIBLE_XO_USER
47+
password:
48+
description:
49+
- Xen Orchestra password.
50+
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_PASSWORD)
51+
will be used instead.
52+
required: true
53+
type: str
54+
env:
55+
- name: ANSIBLE_XO_PASSWORD
56+
validate_certs:
57+
description: Verify TLS certificate if using HTTPS.
58+
type: boolean
59+
default: true
60+
use_ssl:
61+
description: Use wss when connecting to the Xen Orchestra API.
62+
type: boolean
63+
default: true
64+
use_vm_uuid:
65+
description:
66+
- Import Xen VMs to inventory using their UUID as the VM entry name.
67+
- If set to V(false) use VM name labels instead of UUIDs.
68+
type: boolean
69+
default: true
70+
version_added: 10.4.0
71+
use_host_uuid:
72+
description:
73+
- Import Xen Hosts to inventory using their UUID as the Host entry name.
74+
- If set to V(false) use Host name labels instead of UUIDs.
75+
type: boolean
76+
default: true
77+
version_added: 10.4.0
78+
"""
79+
80+
81+
EXAMPLES = r"""
82+
---
7883
# file must be named xen_orchestra.yaml or xen_orchestra.yml
7984
plugin: community.general.xen_orchestra
8085
api_host: 192.168.1.255
@@ -83,13 +88,12 @@
8388
validate_certs: true
8489
use_ssl: true
8590
groups:
86-
kube_nodes: "'kube_node' in tags"
91+
kube_nodes: "'kube_node' in tags"
8792
compose:
88-
ansible_port: 2222
93+
ansible_port: 2222
8994
use_vm_uuid: false
9095
use_host_uuid: true
91-
92-
'''
96+
"""
9397

9498
import json
9599
import ssl

plugins/lookup/bitwarden.py

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,65 @@
55
from __future__ import (absolute_import, division, print_function)
66
__metaclass__ = type
77

8-
DOCUMENTATION = """
9-
name: bitwarden
10-
author:
11-
- Jonathan Lung (@lungj) <[email protected]>
12-
requirements:
13-
- bw (command line utility)
14-
- be logged into bitwarden
15-
- bitwarden vault unlocked
16-
- E(BW_SESSION) environment variable set
17-
short_description: Retrieve secrets from Bitwarden
18-
version_added: 5.4.0
8+
DOCUMENTATION = r"""
9+
name: bitwarden
10+
author:
11+
- Jonathan Lung (@lungj) <[email protected]>
12+
requirements:
13+
- bw (command line utility)
14+
- be logged into bitwarden
15+
- bitwarden vault unlocked
16+
- E(BW_SESSION) environment variable set
17+
short_description: Retrieve secrets from Bitwarden
18+
version_added: 5.4.0
19+
description:
20+
- Retrieve secrets from Bitwarden.
21+
options:
22+
_terms:
23+
description: Key(s) to fetch values for from login info.
24+
required: true
25+
type: list
26+
elements: str
27+
search:
28+
description:
29+
- Field to retrieve, for example V(name) or V(id).
30+
- If set to V(id), only zero or one element can be returned. Use the Jinja C(first) filter to get the only list element.
31+
- If set to V(None) or V(''), or if O(_terms) is empty, records are not filtered by fields.
32+
type: str
33+
default: name
34+
version_added: 5.7.0
35+
field:
36+
description: Field to fetch. Leave unset to fetch whole response.
37+
type: str
38+
collection_id:
39+
description:
40+
- Collection ID to filter results by collection. Leave unset to skip filtering.
41+
- O(collection_id) and O(collection_name) are mutually exclusive.
42+
type: str
43+
version_added: 6.3.0
44+
collection_name:
1945
description:
20-
- Retrieve secrets from Bitwarden.
21-
options:
22-
_terms:
23-
description: Key(s) to fetch values for from login info.
24-
required: true
25-
type: list
26-
elements: str
27-
search:
28-
description:
29-
- Field to retrieve, for example V(name) or V(id).
30-
- If set to V(id), only zero or one element can be returned.
31-
Use the Jinja C(first) filter to get the only list element.
32-
- If set to V(None) or V(''), or if O(_terms) is empty, records are not filtered by fields.
33-
type: str
34-
default: name
35-
version_added: 5.7.0
36-
field:
37-
description: Field to fetch. Leave unset to fetch whole response.
38-
type: str
39-
collection_id:
40-
description:
41-
- Collection ID to filter results by collection. Leave unset to skip filtering.
42-
- O(collection_id) and O(collection_name) are mutually exclusive.
43-
type: str
44-
version_added: 6.3.0
45-
collection_name:
46-
description:
47-
- Collection name to filter results by collection. Leave unset to skip filtering.
48-
- O(collection_id) and O(collection_name) are mutually exclusive.
49-
type: str
50-
version_added: 10.4.0
51-
organization_id:
52-
description: Organization ID to filter results by organization. Leave unset to skip filtering.
53-
type: str
54-
version_added: 8.5.0
55-
bw_session:
56-
description: Pass session key instead of reading from env.
57-
type: str
58-
version_added: 8.4.0
59-
result_count:
60-
description:
61-
- Number of results expected for the lookup query. Task will fail if O(result_count)
62-
is set but does not match the number of query results. Leave empty to skip this check.
63-
type: int
64-
version_added: 10.4.0
46+
- Collection name to filter results by collection. Leave unset to skip filtering.
47+
- O(collection_id) and O(collection_name) are mutually exclusive.
48+
type: str
49+
version_added: 10.4.0
50+
organization_id:
51+
description: Organization ID to filter results by organization. Leave unset to skip filtering.
52+
type: str
53+
version_added: 8.5.0
54+
bw_session:
55+
description: Pass session key instead of reading from env.
56+
type: str
57+
version_added: 8.4.0
58+
result_count:
59+
description:
60+
- Number of results expected for the lookup query. Task will fail if O(result_count) is set but does not match the number
61+
of query results. Leave empty to skip this check.
62+
type: int
63+
version_added: 10.4.0
6564
"""
6665

67-
EXAMPLES = """
66+
EXAMPLES = r"""
6867
- name: "Get 'password' from all Bitwarden records named 'a_test'"
6968
ansible.builtin.debug:
7069
msg: >-
@@ -111,14 +110,14 @@
111110
{{ lookup('community.general.bitwarden', 'a_test', result_count=1) }}
112111
"""
113112

114-
RETURN = """
115-
_raw:
116-
description:
117-
- A one-element list that contains a list of requested fields or JSON objects of matches.
118-
- If you use C(query), you get a list of lists. If you use C(lookup) without C(wantlist=true),
119-
this always gets reduced to a list of field values or JSON objects.
120-
type: list
121-
elements: list
113+
RETURN = r"""
114+
_raw:
115+
description:
116+
- A one-element list that contains a list of requested fields or JSON objects of matches.
117+
- If you use C(query), you get a list of lists. If you use C(lookup) without C(wantlist=true), this always gets reduced
118+
to a list of field values or JSON objects.
119+
type: list
120+
elements: list
122121
"""
123122

124123
from subprocess import Popen, PIPE

0 commit comments

Comments
 (0)