From b01933a2dcb6386ed89684d319bbe6a964d30402 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 15 Feb 2012 17:08:36 -0500 Subject: Print friendly message if no floating IPs exist. Fix bug 932071. Print out a friendly message from nova-manage when the "floating list" command is issued but no floating IPs have been defined. Prior to this change, a generic error message would be printed, pointing to the log for further details. Change-Id: I0d11f93e9f51cf4e99e319bc9296f73380564257 --- bin/nova-manage | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 49ec41656..770b95368 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -721,10 +721,14 @@ class FloatingIpCommands(object): """Lists all floating ips (optionally by host) Note: if host is given, only active floating IPs are returned""" ctxt = context.get_admin_context() - if host is None: - floating_ips = db.floating_ip_get_all(ctxt) - else: - floating_ips = db.floating_ip_get_all_by_host(ctxt, host) + try: + if host is None: + floating_ips = db.floating_ip_get_all(ctxt) + else: + floating_ips = db.floating_ip_get_all_by_host(ctxt, host) + except exception.NoFloatingIpsDefined: + print _("No floating IP addresses have been defined.") + return for floating_ip in floating_ips: instance_id = None if floating_ip['fixed_ip_id']: -- cgit