File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,20 +286,18 @@ def _handle_fixed_ips(port):
286286 if subnet_id :
287287 fixed_ips_element ['subnet_id' ] = subnet_id
288288
289- if 'fixed_ips' not in port and not fixed_ips_element :
290- return
291-
292- elif 'fixed_ips' not in port and fixed_ips_element :
293- port ['fixed_ips' ] = [fixed_ips_element ]
294-
295- addresses = [ip .get ('ip_address' ) for ip in port ['fixed_ips' ]]
296- subnets = [net .get ('subnet_id' ) for net in port ['fixed_ips' ]]
297-
289+ fixed_ips = port .get (
290+ 'fixed_ips' ,
291+ [] if not fixed_ips_element else [fixed_ips_element ])
292+ addresses = [ip .get ('ip_address' ) for ip in fixed_ips ]
293+ subnets = [net .get ('subnet_id' ) for net in fixed_ips ]
298294 # applying fixed ip parameter, if available
299295 if fixed_ips_element and not \
300296 (fixed_ips_element .get ('ip_address' ) in addresses or
301297 fixed_ips_element .get ('subnet_id' ) in subnets ):
302- port ['fixed_ips' ] = [fixed_ips_element ]
298+ fixed_ips .append (fixed_ips_element )
299+ if fixed_ips :
300+ port ['fixed_ips' ] = fixed_ips
303301
304302
305303def _handle_security_groups (port ):
You can’t perform that action at this time.
0 commit comments