diff options
author | Martin Nagy <mnagy@redhat.com> | 2009-06-26 19:37:49 +0200 |
---|---|---|
committer | Martin Nagy <mnagy@redhat.com> | 2009-07-22 18:02:22 +0200 |
commit | de53d0a26e1ad7ae20368967f81b7e6391b7198d (patch) | |
tree | 4533140a67ca71cfbdfe69b50d7c94f773d20bbb /ipaserver/install/bindinstance.py | |
parent | a09d2c34988275178bec1c3b7d15f00e9d0c8db4 (diff) | |
download | freeipa-de53d0a26e1ad7ae20368967f81b7e6391b7198d.tar.gz freeipa-de53d0a26e1ad7ae20368967f81b7e6391b7198d.tar.xz freeipa-de53d0a26e1ad7ae20368967f81b7e6391b7198d.zip |
Make --setup-dns work on replica installation
The ipa-replica-install script will setup the DNS if user specifies the
--setup-dns option. It will only add the zone into LDAP if the
cn=dns,$SUFFIX container doesn't exist. For now, however, we do not add
the records.
Diffstat (limited to 'ipaserver/install/bindinstance.py')
-rw-r--r-- | ipaserver/install/bindinstance.py | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py index f8fc2a980..cadab10e3 100644 --- a/ipaserver/install/bindinstance.py +++ b/ipaserver/install/bindinstance.py @@ -93,10 +93,7 @@ class BindInstance(service.Service): except: pass - # FIXME: this need to be split off, as only the first server can do - # this operation - self.step("Setting up our zone", self.__setup_zone) - self.step("setting up reverse zone", self.__setup_reverse_zone) + self.__add_zone_steps() self.step("setting up kerberos principal", self.__setup_principal) self.step("setting up named.conf", self.__setup_named_conf) @@ -107,6 +104,39 @@ class BindInstance(service.Service): self.step("changing resolv.conf to point to ourselves", self.__setup_resolv_conf) self.start_creation("Configuring named:") + def __add_zone_steps(self): + """ + Add steps necessary to add records and zones, if they don't exist + already. + """ + + def object_exists(dn): + """ + Test whether the given object exists in LDAP. + """ + try: + server.search_ext_s(dn, ldap.SCOPE_BASE) + except ldap.NO_SUCH_OBJECT: + return False + else: + return True + + zone_dn = "idnsName=%s,cn=dns,%s" % (self.domain, self.suffix) + reverse_zone_dn = "idnsName=%s.in-addr.arpa,cn=dns,%s" % (self.reverse_subnet, self.suffix) + + server = ldap.initialize("ldap://" + self.fqdn) + server.simple_bind_s() + if object_exists(zone_dn): + pass # TODO: Add dns records to the zone + else: + self.step("setting up our zone", self.__setup_zone) + if object_exists(reverse_zone_dn): + pass # TODO: Add dns records to the reverse zone + else: + self.step("setting up reverse zone", self.__setup_reverse_zone) + + server.unbind_s() + def __start(self): try: self.backup_state("running", self.is_running()) |