From 345cc4e80de42729f62bd2c5cfe6a2e31273ac4d Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Tue, 19 Dec 2017 10:18:41 +0100 Subject: [PATCH] Return the floating ip object Sometimes it might be useful to have the floating ip object which was assigned Change-Id: I883ec2af448cd38dad2e0d24843c92e7ab495c2f Signed-off-by: Manuel Buil --- snaps/openstack/create_instance.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snaps/openstack/create_instance.py b/snaps/openstack/create_instance.py index 8e3eb01..336c936 100644 --- a/snaps/openstack/create_instance.py +++ b/snaps/openstack/create_instance.py @@ -196,6 +196,7 @@ class OpenStackVmInstance(OpenStackComputeObject): """ Adds a floating IP to a running instance :param floating_ip_setting - the floating IP configuration + :return: the floating ip object """ port_dict = dict() for key, port in self.__ports: @@ -225,6 +226,7 @@ class OpenStackVmInstance(OpenStackComputeObject): 'Created floating IP %s via router - %s', floating_ip.ip, floating_ip_setting.router_name) self.__add_floating_ip(floating_ip, port, subnet) + return floating_ip else: raise VmInstanceCreationError( 'Unable to add floating IP to port, cannot locate router ' -- 2.16.6