On Tue, 2011-06-14 at 13:53 -0400, Rob Crittenden wrote:
> Martin Kosek wrote:
> > This patch depends on my patch 078. A special patch for stable branch
> > attached.
> >
> > ---
> >
> > Create DNS domain for IPA server hostname first so that it's forward
> > record can be added. This results in 2 forward DNS zones created
> > when server hostname doesn't equal server domain.
> >
> > https://fedorahosted.org/freeipa/ticket/1194
> 
> This look ok, just a style question.
> 
> by definition fqdn is fully-qualified so is this necessary?
> 
> +        if '.' in self.fqdn:
> +            self.host_domain = '.'.join(fqdn.split(".")[1:])
> +        else:
> +            self.host_domain = self.domain
> 
> The test will always be true, right?
> 
> rob

It should be. Maybe I was overcautious in this place. Attaching updated
patches.

Martin
>From 7513da959206b02e96e671716bd7270e7fedba68 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Thu, 9 Jun 2011 12:33:09 +0200
Subject: [PATCH] DNS installation fails when domain and host domain mismatch

Create DNS domain for IPA server hostname first so that it's forward
record can be added. This results in 2 forward DNS zones created
when server hostname doesn't equal server domain.

https://fedorahosted.org/freeipa/ticket/1194
---
 ipaserver/install/bindinstance.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 2f897b423f30b6b08127783f00adcd6352f09ca4..8981c2fdbc0c84d611023b4a41e1209996d8035f 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -308,6 +308,7 @@ class BindInstance(service.Service):
         self.domain = domain_name
         self.forwarders = forwarders
         self.host = fqdn.split(".")[0]
+        self.host_domain = '.'.join(fqdn.split(".")[1:])
         self.suffix = util.realm_to_suffix(self.realm)
         self.ntp = ntp
         self.create_reverse = create_reverse
@@ -402,6 +403,14 @@ class BindInstance(service.Service):
         self._ldap_mod("dns.ldif", self.sub_dict)
 
     def __setup_zone(self):
+        if self.host_domain != self.domain:
+            # add DNS domain for host first
+            logging.debug("Host domain (%s) is different from DNS domain (%s)!" \
+                    % (self.host_domain, self.domain))
+            logging.debug("Add DNS zone for host first.")
+
+            add_zone(self.host_domain, self.zonemgr, dns_backup=self.dns_backup,
+                    ns_hostname=api.env.host, ns_ip_address=self.ip_address)
         add_zone(self.domain, self.zonemgr, dns_backup=self.dns_backup,
                 ns_hostname=api.env.host, ns_ip_address=self.ip_address)
 
-- 
1.7.5.2

>From 5e0ce572e288a16aab3b3dc96517f4d402faf766 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Thu, 9 Jun 2011 12:55:01 +0200
Subject: [PATCH] DNS installation fails when domain and host domain mismatch

Create DNS domain for IPA server hostname first so that it's forward
record can be added. This results in 2 forward DNS zones created
when server hostname doesn't equal server domain.

https://fedorahosted.org/freeipa/ticket/1194
---
 ipaserver/install/bindinstance.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index fa27451703d39b7d9607066fb1901fd58c1c9ee9..04e61d543366615ee7bdee9eaa5c9d577bb33dcd 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -267,6 +267,7 @@ class BindInstance(service.Service):
         self.domain = domain_name
         self.forwarders = forwarders
         self.host = fqdn.split(".")[0]
+        self.host_domain = '.'.join(fqdn.split(".")[1:])
         self.suffix = util.realm_to_suffix(self.realm)
         self.ntp = ntp
         self.create_reverse = create_reverse
@@ -361,6 +362,13 @@ class BindInstance(service.Service):
         self._ldap_mod("dns.ldif", self.sub_dict)
 
     def __setup_zone(self):
+        if self.host_domain != self.domain:
+            # add DNS domain for host first
+            logging.debug("Host domain (%s) is different from DNS domain (%s)!" \
+                    % (self.host_domain, self.domain))
+            logging.debug("Add DNS zone for host first.")
+            zone = add_zone(self.host_domain, self.zonemgr,
+                        self.dns_backup, self.ip_address)
         zone = add_zone(self.domain, self.zonemgr,
                         self.dns_backup, self.ip_address)
 
-- 
1.7.5.2

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

Reply via email to