From 3b103f905ec73c1d4f6750112a6dd19ed0e0d475 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 24 Apr 2022 17:42:36 +1200 Subject: [PATCH] Removed 'default=None' in a batch of modules 2 (#4567) * removed default=None * added changelog fragment --- changelogs/fragments/4567-remove-default-none-2.yml | 13 +++++++++++++ plugins/modules/cloud/atomic/atomic_container.py | 4 ++-- plugins/modules/cloud/misc/proxmox.py | 2 +- plugins/modules/cloud/packet/packet_device.py | 2 +- plugins/modules/cloud/packet/packet_sshkey.py | 10 +++++----- plugins/modules/cloud/packet/packet_volume.py | 8 ++++---- plugins/modules/cloud/profitbricks/profitbricks.py | 2 +- plugins/modules/cloud/smartos/smartos_image_info.py | 2 +- plugins/modules/cloud/smartos/vmadm.py | 4 ++-- plugins/modules/cloud/webfaction/webfaction_app.py | 10 +++++----- plugins/modules/cloud/webfaction/webfaction_db.py | 6 +++--- plugins/modules/clustering/nomad/nomad_job.py | 12 ++++++------ plugins/modules/clustering/nomad/nomad_job_info.py | 10 +++++----- 13 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 changelogs/fragments/4567-remove-default-none-2.yml diff --git a/changelogs/fragments/4567-remove-default-none-2.yml b/changelogs/fragments/4567-remove-default-none-2.yml new file mode 100644 index 0000000000..b4ef6ed77e --- /dev/null +++ b/changelogs/fragments/4567-remove-default-none-2.yml @@ -0,0 +1,13 @@ +minor_changes: + - atomic_container - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - proxmox - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - packet_device - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - packet_sshkey - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - packet_volume - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - profitbricks - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - smartos_image_info - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - vmadm - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - webfaction_app - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - webfaction_db - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - nomad_job - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). + - nomad_job_info - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567). diff --git a/plugins/modules/cloud/atomic/atomic_container.py b/plugins/modules/cloud/atomic/atomic_container.py index ca63125661..a6be44317b 100644 --- a/plugins/modules/cloud/atomic/atomic_container.py +++ b/plugins/modules/cloud/atomic/atomic_container.py @@ -182,10 +182,10 @@ def core(module): def main(): module = AnsibleModule( argument_spec=dict( - mode=dict(default=None, choices=['user', 'system']), + mode=dict(choices=['user', 'system']), name=dict(required=True), image=dict(required=True), - rootfs=dict(default=None), + rootfs=dict(), state=dict(default='latest', choices=['present', 'absent', 'latest', 'rollback']), backend=dict(required=True, choices=['docker', 'ostree']), values=dict(type='list', default=[], elements='str'), diff --git a/plugins/modules/cloud/misc/proxmox.py b/plugins/modules/cloud/misc/proxmox.py index 662e834803..e6f9bc5b71 100644 --- a/plugins/modules/cloud/misc/proxmox.py +++ b/plugins/modules/cloud/misc/proxmox.py @@ -564,7 +564,7 @@ def main(): force=dict(type='bool', default=False), purge=dict(type='bool', default=False), state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), - pubkey=dict(type='str', default=None), + pubkey=dict(type='str'), unprivileged=dict(type='bool', default=False), description=dict(type='str'), hookscript=dict(type='str'), diff --git a/plugins/modules/cloud/packet/packet_device.py b/plugins/modules/cloud/packet/packet_device.py index 5912a6f46a..abafa51870 100644 --- a/plugins/modules/cloud/packet/packet_device.py +++ b/plugins/modules/cloud/packet/packet_device.py @@ -630,7 +630,7 @@ def main(): plan=dict(), project_id=dict(required=True), state=dict(choices=ALLOWED_STATES, default='present'), - user_data=dict(default=None), + user_data=dict(), wait_for_public_IPv=dict(type='int', choices=[4, 6]), wait_timeout=dict(type='int', default=900), ipxe_script_url=dict(default=''), diff --git a/plugins/modules/cloud/packet/packet_sshkey.py b/plugins/modules/cloud/packet/packet_sshkey.py index 4800718fd0..77f3a70201 100644 --- a/plugins/modules/cloud/packet/packet_sshkey.py +++ b/plugins/modules/cloud/packet/packet_sshkey.py @@ -226,11 +226,11 @@ def main(): state=dict(choices=['present', 'absent'], default='present'), auth_token=dict(default=os.environ.get(PACKET_API_TOKEN_ENV_VAR), no_log=True), - label=dict(type='str', aliases=['name'], default=None), - id=dict(type='str', default=None), - fingerprint=dict(type='str', default=None), - key=dict(type='str', default=None, no_log=True), - key_file=dict(type='path', default=None), + label=dict(type='str', aliases=['name']), + id=dict(type='str'), + fingerprint=dict(type='str'), + key=dict(type='str', no_log=True), + key_file=dict(type='path'), ), mutually_exclusive=[ ('label', 'id'), diff --git a/plugins/modules/cloud/packet/packet_volume.py b/plugins/modules/cloud/packet/packet_volume.py index 97c1e7498d..4f10bdf45b 100644 --- a/plugins/modules/cloud/packet/packet_volume.py +++ b/plugins/modules/cloud/packet/packet_volume.py @@ -263,9 +263,9 @@ def act_on_volume(target_state, module, packet_conn): def main(): module = AnsibleModule( argument_spec=dict( - id=dict(type='str', default=None), - description=dict(type="str", default=None), - name=dict(type='str', default=None), + id=dict(type='str'), + description=dict(type="str"), + name=dict(type='str'), state=dict(choices=VOLUME_STATES, default="present"), auth_token=dict( type='str', @@ -277,7 +277,7 @@ def main(): facility=dict(type="str"), size=dict(type="int"), locked=dict(type="bool", default=False), - snapshot_policy=dict(type='dict', default=None), + snapshot_policy=dict(type='dict'), billing_cycle=dict(type='str', choices=BILLING, default="hourly"), ), supports_check_mode=True, diff --git a/plugins/modules/cloud/profitbricks/profitbricks.py b/plugins/modules/cloud/profitbricks/profitbricks.py index 3a75778a08..eccedb71f4 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks.py +++ b/plugins/modules/cloud/profitbricks/profitbricks.py @@ -583,7 +583,7 @@ def main(): default='AMD_OPTERON'), volume_size=dict(type='int', default=10), disk_type=dict(choices=['HDD', 'SSD'], default='HDD'), - image_password=dict(default=None, no_log=True), + image_password=dict(no_log=True), ssh_keys=dict(type='list', elements='str', default=[], no_log=False), bus=dict(choices=['VIRTIO', 'IDE'], default='VIRTIO'), lan=dict(type='int', default=1), diff --git a/plugins/modules/cloud/smartos/smartos_image_info.py b/plugins/modules/cloud/smartos/smartos_image_info.py index 369559f52a..0aa9c3ac1c 100644 --- a/plugins/modules/cloud/smartos/smartos_image_info.py +++ b/plugins/modules/cloud/smartos/smartos_image_info.py @@ -95,7 +95,7 @@ class ImageFacts(object): def main(): module = AnsibleModule( argument_spec=dict( - filters=dict(default=None), + filters=dict(), ), supports_check_mode=True, ) diff --git a/plugins/modules/cloud/smartos/vmadm.py b/plugins/modules/cloud/smartos/vmadm.py index 03a022423e..c3cc4b7530 100644 --- a/plugins/modules/cloud/smartos/vmadm.py +++ b/plugins/modules/cloud/smartos/vmadm.py @@ -684,7 +684,7 @@ def main(): choices=['present', 'running', 'absent', 'deleted', 'stopped', 'created', 'restarted', 'rebooted'] ), name=dict( - default=None, type='str', + type='str', aliases=['alias'] ), brand=dict( @@ -709,7 +709,7 @@ def main(): # Add our 'simple' options to options dict. for type in properties: for p in properties[type]: - option = dict(default=None, type=type) + option = dict(type=type) options[p] = option module = AnsibleModule( diff --git a/plugins/modules/cloud/webfaction/webfaction_app.py b/plugins/modules/cloud/webfaction/webfaction_app.py index 1839db3810..cd779b035a 100644 --- a/plugins/modules/cloud/webfaction/webfaction_app.py +++ b/plugins/modules/cloud/webfaction/webfaction_app.py @@ -110,14 +110,14 @@ def main(): module = AnsibleModule( argument_spec=dict( name=dict(required=True), - state=dict(required=False, choices=['present', 'absent'], default='present'), + state=dict(choices=['present', 'absent'], default='present'), type=dict(required=True), - autostart=dict(required=False, type='bool', default=False), - extra_info=dict(required=False, default=""), - port_open=dict(required=False, type='bool', default=False), + autostart=dict(type='bool', default=False), + extra_info=dict(default=""), + port_open=dict(type='bool', default=False), login_name=dict(required=True), login_password=dict(required=True, no_log=True), - machine=dict(required=False, default=None), + machine=dict(), ), supports_check_mode=True ) diff --git a/plugins/modules/cloud/webfaction/webfaction_db.py b/plugins/modules/cloud/webfaction/webfaction_db.py index 11563426d7..8708c7743b 100644 --- a/plugins/modules/cloud/webfaction/webfaction_db.py +++ b/plugins/modules/cloud/webfaction/webfaction_db.py @@ -101,13 +101,13 @@ def main(): module = AnsibleModule( argument_spec=dict( name=dict(required=True), - state=dict(required=False, choices=['present', 'absent'], default='present'), + state=dict(choices=['present', 'absent'], default='present'), # You can specify an IP address or hostname. type=dict(required=True, choices=['mysql', 'postgresql']), - password=dict(required=False, default=None, no_log=True), + password=dict(no_log=True), login_name=dict(required=True), login_password=dict(required=True, no_log=True), - machine=dict(required=False, default=None), + machine=dict(), ), supports_check_mode=True ) diff --git a/plugins/modules/clustering/nomad/nomad_job.py b/plugins/modules/clustering/nomad/nomad_job.py index 341592be50..92081dfabd 100644 --- a/plugins/modules/clustering/nomad/nomad_job.py +++ b/plugins/modules/clustering/nomad/nomad_job.py @@ -102,14 +102,14 @@ def run(): use_ssl=dict(type='bool', default=True), timeout=dict(type='int', default=5), validate_certs=dict(type='bool', default=True), - client_cert=dict(type='path', default=None), - client_key=dict(type='path', default=None), - namespace=dict(type='str', default=None), - name=dict(type='str', default=None), + client_cert=dict(type='path'), + client_key=dict(type='path'), + namespace=dict(type='str'), + name=dict(type='str'), content_format=dict(choices=['hcl', 'json'], default='hcl'), - content=dict(type='str', default=None), + content=dict(type='str'), force_start=dict(type='bool', default=False), - token=dict(type='str', default=None, no_log=True) + token=dict(type='str', no_log=True) ), supports_check_mode=True, mutually_exclusive=[ diff --git a/plugins/modules/clustering/nomad/nomad_job_info.py b/plugins/modules/clustering/nomad/nomad_job_info.py index d49111bb4f..3d15712fda 100644 --- a/plugins/modules/clustering/nomad/nomad_job_info.py +++ b/plugins/modules/clustering/nomad/nomad_job_info.py @@ -287,11 +287,11 @@ def run(): use_ssl=dict(type='bool', default=True), timeout=dict(type='int', default=5), validate_certs=dict(type='bool', default=True), - client_cert=dict(type='path', default=None), - client_key=dict(type='path', default=None), - namespace=dict(type='str', default=None), - name=dict(type='str', default=None), - token=dict(type='str', default=None, no_log=True) + client_cert=dict(type='path'), + client_key=dict(type='path'), + namespace=dict(type='str'), + name=dict(type='str'), + token=dict(type='str', no_log=True) ), supports_check_mode=True )