From ae2e49a22277a17269833ec13fa657fdc2547b36 Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Fri, 20 Jan 2012 15:15:11 +0100 Subject: Improve host-add error message host-add command allows to add a host and its IP address via --ip-address option. When the address is invalid, it throws an error and refuses to operate. However, the invalid IP address error message is always the same which is not right as it forces a user to guess the reason of rejection (loopback address, link-local address or invalid address at all was passed, etc.). This patch changes host-add validator to print the error message. https://fedorahosted.org/freeipa/ticket/2229 --- ipalib/plugins/host.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index 33d60ad1..fb5f4ea2 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -203,8 +203,8 @@ def validate_ipaddr(ugettext, ipaddr): """ try: ip = CheckedIPAddress(ipaddr, match_local=False) - except: - return _('invalid IP address') + except Exception, e: + return unicode(e) return None -- cgit