Re: [Freeipa-devel] [PATCH] 073 IPA installation with --no-host-dns fails

2011-06-10 Thread Martin Kosek
On Thu, 2011-06-09 at 14:14 -0400, Rob Crittenden wrote:
 Martin Kosek wrote:
  Patch for both master and ipa-2-0 branch attached.
  ---
  --no-host-dns option should allow installing IPA server on a host
  without a DNS resolvable name.
 
  Update parse_ip_address and verify_ip_address functions has been
  changed not to return None and print error messages in case of
  an error, but rather let the Exception be handled by the calling
  routine.
 
  https://fedorahosted.org/freeipa/ticket/1246
 
 ack for both

Pushed to master, ipa-2-0.

Martin

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 073 IPA installation with --no-host-dns fails

2011-06-09 Thread Rob Crittenden

Martin Kosek wrote:

Patch for both master and ipa-2-0 branch attached.
---
--no-host-dns option should allow installing IPA server on a host
without a DNS resolvable name.

Update parse_ip_address and verify_ip_address functions has been
changed not to return None and print error messages in case of
an error, but rather let the Exception be handled by the calling
routine.

https://fedorahosted.org/freeipa/ticket/1246


ack for both

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 073 IPA installation with --no-host-dns fails

2011-06-08 Thread Martin Kosek
On Tue, 2011-06-07 at 14:10 -0400, Rob Crittenden wrote:
 Martin Kosek wrote:
  Patch for both master and ipa-2-0 branch attached.
  ---
  --no-host-dns option should allow installing IPA server on a host
  without a DNS resolvable name.
 
  Update parse_ip_address and verify_ip_address functions has been
  changed not to return None and print error messages in case of
  an error, but rather let the Exception be handled by the calling
  routine.
 
  https://fedorahosted.org/freeipa/ticket/1246
 
  https://www.redhat.com/mailman/listinfo/freeipa-devel
 
 Why remove the IP address validation from ipa-replica-prepare?
 
 rob

Because it is redundant. As the ip_address parameter in IPAOptionParser
has type=ipnet it is automatically validated during
parser.parse_args().

Martin

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 073 IPA installation with --no-host-dns fails

2011-06-07 Thread Rob Crittenden

Martin Kosek wrote:

Patch for both master and ipa-2-0 branch attached.
---
--no-host-dns option should allow installing IPA server on a host
without a DNS resolvable name.

Update parse_ip_address and verify_ip_address functions has been
changed not to return None and print error messages in case of
an error, but rather let the Exception be handled by the calling
routine.

https://fedorahosted.org/freeipa/ticket/1246

https://www.redhat.com/mailman/listinfo/freeipa-devel


Why remove the IP address validation from ipa-replica-prepare?

rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 073 IPA installation with --no-host-dns fails

2011-06-01 Thread Martin Kosek
Patch for both master and ipa-2-0 branch attached.
---
--no-host-dns option should allow installing IPA server on a host
without a DNS resolvable name.

Update parse_ip_address and verify_ip_address functions has been
changed not to return None and print error messages in case of
an error, but rather let the Exception be handled by the calling
routine.

https://fedorahosted.org/freeipa/ticket/1246

From cfcd83e387b750459e6d3df420aad975a94991e0 Mon Sep 17 00:00:00 2001
From: Martin Kosek mko...@redhat.com
Date: Tue, 31 May 2011 12:51:38 +0200
Subject: [PATCH] IPA installation with --no-host-dns fails

--no-host-dns option should allow installing IPA server on a host
without a DNS resolvable name.

Update parse_ip_address and verify_ip_address functions has been
changed not to return None and print error messages in case of
an error, but rather let the Exception be handled by the calling
routine.

https://fedorahosted.org/freeipa/ticket/1246
---
 install/tools/ipa-dns-install |9 -
 install/tools/ipa-replica-prepare |5 -
 install/tools/ipa-server-install  |   21 +++--
 ipaserver/install/installutils.py |   37 +++--
 4 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index 91edcca8a438871cb73a6792105e24040b77953e..39998ac47b02244aaec1d09a14980db25ec636f4 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -108,7 +108,14 @@ def main():
 else:
 hostaddr = resolve_host(api.env.host)
 ip_address = hostaddr and ipautil.CheckedIPAddress(hostaddr)
-if not ip_address or not verify_ip_address(ip_address):
+
+try:
+verify_ip_address(ip_address)
+except Exception, e:
+print Error: Invalid IP Address %s: %s % (ip_address, e)
+ip_address = None
+
+if not ip_address:
 if options.unattended:
 sys.exit(Unable to resolve IP address for host name)
 else:
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index 2765e4a0e5635d5400241d83070f58c46a13f840..ac70f7c9b09a0e0655ee2f83413cc74a99e3c8ae 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -78,11 +78,6 @@ def parse_options():
 if cnt  0 and cnt  num:
 parser.error(All PKCS#12 options are required if any are used.)
 
-if options.ip_address:
-if not installutils.verify_ip_address(options.ip_address, match_local=False):
-parser.error(Bad IP address)
-sys.exit(1)
-
 if len(args) != 1:
 parser.error(must provide the fully-qualified name of the replica)
 
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 23e495e6348f588970e444a95841c73e66f26ee2..70d2d8963fb9cead9474134b1d3dab1c866364b5 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -598,14 +598,20 @@ def main():
 if hostaddr is not None:
 ip = CheckedIPAddress(hostaddr)
 else:
+if not options.ip_address:
+print Unable to resolve IP address for host name
 ip = options.ip_address
 if ip is None and options.unattended:
 sys.exit(Unable to resolve IP address for host name)
 
-if not verify_ip_address(ip):
-ip = None
-if options.unattended:
-sys.exit(1)
+if ip:
+try:
+verify_ip_address(ip)
+except Exception, e:
+print Error: Invalid IP Address %s: %s % (ip, e)
+if options.unattended:
+sys.exit(1)
+ip = None
 
 if options.ip_address:
 if options.ip_address != ip and not options.setup_dns:
@@ -615,8 +621,11 @@ def main():
 return 1
 
 ip = options.ip_address
-if not verify_ip_address(ip):
-return 1
+try:
+verify_ip_address(ip)
+except Exception, e:
+print Error: Invalid IP Address %s: %s % (ip, e)
+sys.exit(1)
 
 if ip is None:
 ip = read_ip_address(host_name, fstore)
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index d99af3742a288c60dbf11530587f3f0eb9540161..d203f4f9392a0738cc9fe2486a9f0ef6b9a64f3c 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -108,6 +108,10 @@ def verify_fqdn(host_name,no_host_dns=False):
 if host_name != host_name.lower():
 raise RuntimeError(Invalid hostname '%s', must be lower-case. % host_name)
 
+if no_host_dns:
+print Warning: skipping DNS resolution of host, host_name
+return
+
 try:
 hostaddr = socket.getaddrinfo(host_name, None)
 except:
@@ -127,10 +131,6 @@ def verify_fqdn(host_name,no_host_dns=False):
 if revname != host_name:
 raise RuntimeError(The host name %s does not match the reverse lookup %s % (host_name,