Skip to content

Commit

Permalink
#71 fixes for dns_server spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Gevorg-Khachatryaan authored and Gevorg-Khachatryaan committed Feb 10, 2022
1 parent 160b442 commit 2c0a4d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion plugins/module_utils/prism/vpcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def _build_spec_routable_ips(self, payload, ips):
return payload, None

def _build_dns_servers(self, payload, dns_servers):
payload["spec"]["resources"]["common_domain_name_server_ip_list"] = dns_servers
payload["spec"]["resources"]["common_domain_name_server_ip_list"] = [
{"ip": i} for i in dns_servers
]
return payload, None

def _get_external_subnet_ref_spec(self, uuid):
Expand Down
16 changes: 13 additions & 3 deletions plugins/modules/ntnx_vpcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
default: True
name:
description: vpc Name
required: True
type: str
vpc_uuid:
description: vpc uuid
type: str
dns_servers:
description: List of DNS servers IPs
Expand Down Expand Up @@ -117,7 +119,8 @@ def get_module_spec():
network_ip=dict(type="str"), network_prefix=dict(type="str")
)
module_args = dict(
name=dict(type="str", required=True),
name=dict(type="str"),
vpc_uuid=dict(type="str"),
external_subnets=dict(
type="list",
elements="dict",
Expand Down Expand Up @@ -194,7 +197,14 @@ def wait_for_task_completion(module, result):


def run_module():
module = BaseModule(argument_spec=get_module_spec(), supports_check_mode=True)
module = BaseModule(
argument_spec=get_module_spec(),
supports_check_mode=True,
required_if=[
("state", "present", ("name",)),
("state", "absent", ("vpc_uuid",)),
],
)
remove_param_with_none_value(module.params)
result = {
"changed": False,
Expand Down

0 comments on commit 2c0a4d5

Please sign in to comment.