Skip to content

Commit a5773bf

Browse files
committed
proxmox_zone: Fix sanity issues
- Fix PEP8 issues - Fix Doc issues for dnszone - Add workaround for author string - Add attribute check_mode and diff_mode - Add no_log=False for lock_token as this is not a secret - Add proxmox_zone to runtime.yml
1 parent 0c0bb74 commit a5773bf

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

meta/runtime.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ action_groups:
3535
- proxmox_user
3636
- proxmox_user_info
3737
- proxmox_vm_info
38+
- proxmox_zone

plugins/modules/proxmox_zone.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
short_description: Manage Proxmox zone configurations
1818
description:
1919
- list/create/update/delete proxmox sdn zones
20-
author: 'Jana Hoch <[email protected]>'
20+
author: 'Jana Hoch <[email protected]> (!UNKNOWN)'
21+
attributes:
22+
check_mode:
23+
support: none
24+
diff_mode:
25+
support: none
2126
options:
2227
state:
2328
description:
@@ -80,7 +85,7 @@
8085
type: str
8186
dnszone:
8287
description:
83-
- dns domain zone ex: mydomain.com
88+
- dns domain zone.
8489
type: str
8590
dp_id:
8691
description:
@@ -167,7 +172,7 @@
167172
api_password: "{{ vault.proxmox.root_password }}"
168173
api_host: "{{ pc.proxmox.api_host }}"
169174
validate_certs: no
170-
175+
171176
- name: Get all simple zones
172177
community.proxmox.proxmox_zone:
173178
api_user: "root@pam"
@@ -186,7 +191,7 @@
186191
type: simple
187192
zone: ansible
188193
state: present
189-
194+
190195
- name: create a vlan zones
191196
community.proxmox.proxmox_zone:
192197
api_user: "root@pam"
@@ -197,7 +202,7 @@
197202
zone: ansible
198203
state: present
199204
bridge: vmbr0
200-
205+
201206
- name: update a zones
202207
community.proxmox.proxmox_zone:
203208
api_user: "root@pam"
@@ -208,7 +213,7 @@
208213
zone: ansible
209214
state: update
210215
mtu: 1200
211-
216+
212217
- name: Delete a zones
213218
community.proxmox.proxmox_zone:
214219
api_user: "root@pam"
@@ -222,14 +227,14 @@
222227

223228
RETURN = r"""
224229
zones:
225-
description:
226-
- List of zones. if you do not pass zone name.
230+
description:
231+
- List of zones. if you do not pass zone name.
227232
- If you are creating/updating/deleting it'll just return a msg with status
228233
returned: on success
229234
type: list
230235
elements: dict
231236
sample:
232-
[
237+
[
233238
{
234239
"digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d",
235240
"type": "simple",
@@ -263,7 +268,7 @@
263268
"zone": "tsjsfv"
264269
}
265270
]
266-
271+
267272
"""
268273

269274
from ansible.module_utils.basic import AnsibleModule
@@ -272,6 +277,7 @@
272277
ProxmoxAnsible
273278
)
274279

280+
275281
def get_proxmox_args():
276282
return dict(
277283
state=dict(type="str", choices=["present", "absent", "update"], required=False),
@@ -294,7 +300,7 @@ def get_proxmox_args():
294300
exitnodes_primary=dict(type="str", required=False),
295301
fabric=dict(type="str", required=False),
296302
ipam=dict(type="str", required=False),
297-
lock_token=dict(type="str", required=False),
303+
lock_token=dict(type="str", required=False, no_log=False),
298304
mac=dict(type="str", required=False),
299305
mtu=dict(type="int", required=False),
300306
nodes=dict(type="str", required=False),
@@ -307,6 +313,7 @@ def get_proxmox_args():
307313
vxlan_port=dict(type="int", required=False),
308314
)
309315

316+
310317
def get_ansible_module():
311318
module_args = proxmox_auth_argument_spec()
312319
module_args.update(get_proxmox_args())
@@ -320,6 +327,7 @@ def get_ansible_module():
320327
]
321328
)
322329

330+
323331
class ProxmoxZoneAnsible(ProxmoxAnsible):
324332
def __init__(self, module):
325333
super(ProxmoxZoneAnsible, self).__init__(module)
@@ -406,7 +414,6 @@ def run(self):
406414
)
407415

408416
def get_zones(self, **type):
409-
print("reached")
410417
try:
411418
return self.proxmox_api.cluster().sdn().zones().get(**type)
412419
except Exception as e:
@@ -503,7 +510,6 @@ def zone_absent(self, zone_name, lock):
503510
)
504511

505512

506-
507513
def main():
508514
module = get_ansible_module()
509515
proxmox = ProxmoxZoneAnsible(module)
@@ -513,5 +519,6 @@ def main():
513519
except Exception as e:
514520
module.fail_json(msg=f'An error occurred: {e}')
515521

522+
516523
if __name__ == "__main__":
517-
main()
524+
main()

0 commit comments

Comments
 (0)