Handle binding:vnic_type as optional (#55526)
According to the OpenStack Networking API the attribute binding:vnic_type of a port is optional. This change enables the os_port module to handle binding:vnic_type as optional.
This commit is contained in:
parent
db6407d6bf
commit
bc50a52ee2
2 changed files with 10 additions and 7 deletions
5
changelogs/fragments/55526-optional_vnic_type.yml
Normal file
5
changelogs/fragments/55526-optional_vnic_type.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- os_port - handle binding:vnic_type as optional
|
||||||
|
(https://github.com/ansible/ansible/issues/55524,
|
||||||
|
https://github.com/ansible/ansible/issues/55525)
|
|
@ -84,7 +84,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- The type of the port that should be created
|
- The type of the port that should be created
|
||||||
choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder]
|
choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder]
|
||||||
default: normal
|
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
port_security_enabled:
|
port_security_enabled:
|
||||||
description:
|
description:
|
||||||
|
@ -327,7 +326,7 @@ def main():
|
||||||
device_owner=dict(default=None),
|
device_owner=dict(default=None),
|
||||||
device_id=dict(default=None),
|
device_id=dict(default=None),
|
||||||
state=dict(default='present', choices=['absent', 'present']),
|
state=dict(default='present', choices=['absent', 'present']),
|
||||||
vnic_type=dict(default='normal',
|
vnic_type=dict(default=None,
|
||||||
choices=['normal', 'direct', 'direct-physical',
|
choices=['normal', 'direct', 'direct-physical',
|
||||||
'macvtap', 'baremetal', 'virtio-forwarder']),
|
'macvtap', 'baremetal', 'virtio-forwarder']),
|
||||||
port_security_enabled=dict(default=None, type='bool')
|
port_security_enabled=dict(default=None, type='bool')
|
||||||
|
@ -355,11 +354,10 @@ def main():
|
||||||
for v in module.params['security_groups']
|
for v in module.params['security_groups']
|
||||||
]
|
]
|
||||||
|
|
||||||
if module.params['vnic_type']:
|
# Neutron API accept 'binding:vnic_type' as an argument
|
||||||
# Neutron API accept 'binding:vnic_type' as an argument
|
# for the port type.
|
||||||
# for the port type.
|
module.params['binding:vnic_type'] = module.params['vnic_type']
|
||||||
module.params['binding:vnic_type'] = module.params['vnic_type']
|
module.params.pop('vnic_type', None)
|
||||||
module.params.pop('vnic_type', None)
|
|
||||||
|
|
||||||
port = None
|
port = None
|
||||||
network_id = None
|
network_id = None
|
||||||
|
|
Loading…
Reference in a new issue