Return the floating ip object 63/49263/3
authorManuel Buil <mbuil@suse.com>
Tue, 19 Dec 2017 09:18:41 +0000 (10:18 +0100)
committerManuel Buil <mbuil@suse.com>
Tue, 19 Dec 2017 16:29:37 +0000 (16:29 +0000)
Sometimes it might be useful to have the floating ip object which was assigned

Change-Id: I883ec2af448cd38dad2e0d24843c92e7ab495c2f
Signed-off-by: Manuel Buil <mbuil@suse.com>
snaps/openstack/create_instance.py

index 8e3eb01..336c936 100644 (file)
@@ -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 '