Skip to content

Commit

Permalink
argument spec updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Gevorg-Khachatryaan authored and Gevorg-Khachatryaan committed Jan 28, 2022
1 parent 9ab92d4 commit 4e838de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
23 changes: 19 additions & 4 deletions plugins/module_utils/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import absolute_import, division, print_function

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback

__metaclass__ = type

Expand All @@ -11,10 +12,24 @@ class BaseModule(AnsibleModule):
"""Basic module with common arguments"""

argument_spec = dict(
action=dict(type="str", required=True, aliases=["state"]),
wait=dict(type="bool", required=False, default=True),
wait_timeout=dict(type="int", required=False, default=300),
validate_certs=dict(type="bool", required=False, default=False),
nutanix_host=dict(
type="str", required=True, fallback=(env_fallback, ["NUTANIX_HOST"])
),
nutanix_port=dict(default="9440", type="str"),
nutanix_username=dict(
type="str", required=True, fallback=(env_fallback, ["NUTANIX_USERNAME"])
),
nutanix_password=dict(
type="str",
required=True,
no_log=True,
fallback=(env_fallback, ["NUTANIX_PASSWORD"]),
),
validate_certs=dict(
type="bool", default=True, fallback=(env_fallback, ["VALIDATE_CERTS"])
),
state=dict(type="str", choices=["present", "absent"], default="present"),
wait=dict(type="bool", default=True),
)

def __init__(self, **kwargs):
Expand Down
20 changes: 0 additions & 20 deletions plugins/modules/ntnx_vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@
# TODO
"""

from ansible.module_utils.basic import env_fallback

from ..module_utils.base_module import BaseModule
from ..module_utils.prism.vms import VM
from ..module_utils.prism.tasks import Task
Expand Down Expand Up @@ -329,24 +327,6 @@ def get_module_spec():
)

module_args = dict(
nutanix_host=dict(
type="str", required=True, fallback=(env_fallback, ["NUTANIX_HOST"])
),
nutanix_port=dict(default="9440", type="str"),
nutanix_username=dict(
type="str", required=True, fallback=(env_fallback, ["NUTANIX_USERNAME"])
),
nutanix_password=dict(
type="str",
required=True,
no_log=True,
fallback=(env_fallback, ["NUTANIX_PASSWORD"]),
),
validate_certs=dict(
type="bool", default=True, fallback=(env_fallback, ["VALIDATE_CERTS"])
),
state=dict(type="str", choices=["present", "absent"], default="present"),
wait=dict(type="bool", default=True),
name=dict(type="str", required=True),
vm_uuid=dict(type="str"),
desc=dict(type="str"),
Expand Down

0 comments on commit 4e838de

Please sign in to comment.