mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #41552 from Enquier/neutron-floatingip-remove
Adding logic so that update_floatingip can dissassociate floatingip's
This commit is contained in:
commit
846ca54688
@ -816,7 +816,7 @@ def create_floatingip(floating_network, port=None, profile=None):
|
||||
return conn.create_floatingip(floating_network, port)
|
||||
|
||||
|
||||
def update_floatingip(floatingip_id, port, profile=None):
|
||||
def update_floatingip(floatingip_id, port=None, profile=None):
|
||||
'''
|
||||
Updates a floatingIP
|
||||
|
||||
@ -827,7 +827,8 @@ def update_floatingip(floatingip_id, port, profile=None):
|
||||
salt '*' neutron.update_floatingip network-name port-name
|
||||
|
||||
:param floatingip_id: ID of floatingIP
|
||||
:param port: ID or name of port
|
||||
:param port: ID or name of port, to associate floatingip to
|
||||
`None` or do not specify to disassociate the floatingip (Optional)
|
||||
:param profile: Profile to build on (Optional)
|
||||
:return: Value of updated floating IP information
|
||||
'''
|
||||
|
@ -537,12 +537,16 @@ class SaltNeutron(NeutronShell):
|
||||
|
||||
return self.network_conn.create_floatingip(body={'floatingip': body})
|
||||
|
||||
def update_floatingip(self, floatingip_id, port):
|
||||
def update_floatingip(self, floatingip_id, port=None):
|
||||
'''
|
||||
Updates a floatingip
|
||||
Updates a floatingip, disassociates the floating ip if
|
||||
port is set to `None`
|
||||
'''
|
||||
port_id = self._find_port_id(port)
|
||||
body = {'floatingip': {'port_id': port_id}}
|
||||
if port is None:
|
||||
body = {'floatingip': {}}
|
||||
else:
|
||||
port_id = self._find_port_id(port)
|
||||
body = {'floatingip': {'port_id': port_id}}
|
||||
return self.network_conn.update_floatingip(
|
||||
floatingip=floatingip_id, body=body)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user