summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/compute/v2/server.py')
-rw-r--r--openstackclient/compute/v2/server.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index e5a7a328..30057111 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -292,6 +292,10 @@ class AddFloatingIP(network_common.NetworkAndComputeCommand):
parsed_args.server,
)
ports = list(client.ports(device_id=server.id))
+ if not ports:
+ msg = _('No attached ports found to associate floating IP with')
+ raise exceptions.CommandError(msg)
+
# If the fixed IP address was specified, we need to find the
# corresponding port.
if parsed_args.fixed_ip_address: