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:
Dominik Holler 2019-05-24 18:22:16 +03:00 committed by jctanner
parent db6407d6bf
commit bc50a52ee2
2 changed files with 10 additions and 7 deletions

View 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)

View file

@ -84,7 +84,6 @@ options:
description:
- The type of the port that should be created
choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder]
default: normal
version_added: "2.8"
port_security_enabled:
description:
@ -327,7 +326,7 @@ def main():
device_owner=dict(default=None),
device_id=dict(default=None),
state=dict(default='present', choices=['absent', 'present']),
vnic_type=dict(default='normal',
vnic_type=dict(default=None,
choices=['normal', 'direct', 'direct-physical',
'macvtap', 'baremetal', 'virtio-forwarder']),
port_security_enabled=dict(default=None, type='bool')
@ -355,11 +354,10 @@ def main():
for v in module.params['security_groups']
]
if module.params['vnic_type']:
# Neutron API accept 'binding:vnic_type' as an argument
# for the port type.
module.params['binding:vnic_type'] = module.params['vnic_type']
module.params.pop('vnic_type', None)
# Neutron API accept 'binding:vnic_type' as an argument
# for the port type.
module.params['binding:vnic_type'] = module.params['vnic_type']
module.params.pop('vnic_type', None)
port = None
network_id = None