mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-07-30 03:34:30 +00:00
Bump minimum openstacksdk version when using os_network/dns_domain
With the addition of [a], the minimum openstacksdk version needs to be bumped to include [b], or the os_network module will return the error: TypeError: create_network() got an unexpected keyword argument 'dns_domain' To handle this, we fail the module if the dns_domain argument is used and the minimum openstacksdk version for that argument is not met. [a]6c74e29618[b]a3e846e2b9Fixes: #64495 Fixes: #64841 Change-Id: I8c41e505d5c1949ddc535c78933da06405c47299
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
bugfixes:
|
||||||
|
- bump the minimum openstacksdk version when os_network
|
||||||
|
uses the dns_domain argument
|
||||||
@@ -77,7 +77,7 @@ options:
|
|||||||
type: int
|
type: int
|
||||||
dns_domain:
|
dns_domain:
|
||||||
description:
|
description:
|
||||||
- The DNS domain value to set.
|
- The DNS domain value to set. Requires openstacksdk>=0.29.
|
||||||
Network will use Openstack defaults if this option is
|
Network will use Openstack defaults if this option is
|
||||||
not provided.
|
not provided.
|
||||||
requirements:
|
requirements:
|
||||||
@@ -193,12 +193,18 @@ def main():
|
|||||||
provider_physical_network = module.params['provider_physical_network']
|
provider_physical_network = module.params['provider_physical_network']
|
||||||
provider_network_type = module.params['provider_network_type']
|
provider_network_type = module.params['provider_network_type']
|
||||||
provider_segmentation_id = module.params['provider_segmentation_id']
|
provider_segmentation_id = module.params['provider_segmentation_id']
|
||||||
project = module.params.get('project')
|
project = module.params['project']
|
||||||
port_security_enabled = module.params.get('port_security_enabled')
|
|
||||||
mtu = module.params.get('mtu')
|
|
||||||
dns_domain = module.params.get('dns_domain')
|
|
||||||
|
|
||||||
sdk, cloud = openstack_cloud_from_module(module)
|
net_create_kwargs = {
|
||||||
|
'port_security_enabled': module.params['port_security_enabled'],
|
||||||
|
'mtu_size': module.params['mtu']
|
||||||
|
}
|
||||||
|
|
||||||
|
if module.params['dns_domain'] is not None:
|
||||||
|
sdk, cloud = openstack_cloud_from_module(module, min_version='0.29.0')
|
||||||
|
net_create_kwargs['dns_domain'] = module.params['dns_domain']
|
||||||
|
else:
|
||||||
|
sdk, cloud = openstack_cloud_from_module(module)
|
||||||
try:
|
try:
|
||||||
if project is not None:
|
if project is not None:
|
||||||
proj = cloud.get_project(project)
|
proj = cloud.get_project(project)
|
||||||
@@ -224,13 +230,11 @@ def main():
|
|||||||
if project_id is not None:
|
if project_id is not None:
|
||||||
net = cloud.create_network(name, shared, admin_state_up,
|
net = cloud.create_network(name, shared, admin_state_up,
|
||||||
external, provider, project_id,
|
external, provider, project_id,
|
||||||
port_security_enabled=port_security_enabled,
|
**net_create_kwargs)
|
||||||
mtu_size=mtu, dns_domain=dns_domain)
|
|
||||||
else:
|
else:
|
||||||
net = cloud.create_network(name, shared, admin_state_up,
|
net = cloud.create_network(name, shared, admin_state_up,
|
||||||
external, provider,
|
external, provider,
|
||||||
port_security_enabled=port_security_enabled,
|
**net_create_kwargs)
|
||||||
mtu_size=mtu, dns_domain=dns_domain)
|
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
changed = False
|
changed = False
|
||||||
|
|||||||
Reference in New Issue
Block a user