From ef12cad30b3fc867b3b09abe6521c168dbc3ceaf Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Jun 17 2016 16:05:03 +0000 Subject: DNS Locations: set proper substitution variable DNS Server (bind-dyndb-ldap) needs to have set 'idnsSubstitutionVariable;ipalocation' in ldap to the proper location https://fedorahosted.org/freeipa/ticket/2008 Reviewed-By: Petr Spacek --- diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py index 344756f..a39d268 100644 --- a/ipaserver/plugins/server.py +++ b/ipaserver/plugins/server.py @@ -232,6 +232,26 @@ class server_mod(LDAPUpdate): assert isinstance(dn, DN) self.obj.get_enabled_roles(entry_attrs) + if 'ipalocation_location' in options: + ipalocation = entry_attrs.get('ipalocation') + if ipalocation: + ipalocation = ipalocation[0]['idnsname'] + else: + ipalocation = u'' + try: + self.api.Command.dnsserver_mod( + keys[0], + setattr=[ + u'idnsSubstitutionVariable;ipalocation={loc}'.format( + loc=ipalocation) + ] + ) + except errors.EmptyModlist: + pass + except errors.NotFound: + # server is not DNS server + pass + if 'ipalocation' or 'ipalocationweight' in entry_attrs: result = self.api.Command.dns_update_system_records() if not result.get('value'):