summaryrefslogtreecommitdiffstats
path: root/ipaclient/plugins/dns.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-06-10 17:03:25 +0200
committerMartin Basti <mbasti@redhat.com>2016-06-17 15:22:24 +0200
commite23159596e1851f156461d00b9f9f99dc698e12b (patch)
tree5c3f2436a80b7326ad39eaa798f2fa538dfda68d /ipaclient/plugins/dns.py
parentcf634a4ff8a100589f99e57c51b2c4591853e88a (diff)
downloadfreeipa-e23159596e1851f156461d00b9f9f99dc698e12b.tar.gz
freeipa-e23159596e1851f156461d00b9f9f99dc698e12b.tar.xz
freeipa-e23159596e1851f156461d00b9f9f99dc698e12b.zip
DNS Locations: command dns-update-system-records
command dns-update-system-records updates/fixes DNS records for IPA services: * updating A, AAAA records for CA * updating SRV records for LDAP, kerberos and AD trust * updating TXT record in _kerberos with proper realm * updating dns locations if used https://fedorahosted.org/freeipa/ticket/2008 Reviewed-By: Petr Spacek <pspacek@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient/plugins/dns.py')
-rw-r--r--ipaclient/plugins/dns.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/ipaclient/plugins/dns.py b/ipaclient/plugins/dns.py
index 4defb7c33..06cd2c281 100644
--- a/ipaclient/plugins/dns.py
+++ b/ipaclient/plugins/dns.py
@@ -21,8 +21,9 @@
from __future__ import print_function
import six
+import copy
-from ipaclient.frontend import MethodOverride
+from ipaclient.frontend import MethodOverride, CommandOverride
from ipalib import errors
from ipalib.dns import (get_record_rrtype,
has_cli_options,
@@ -342,3 +343,29 @@ class dnsforwardzone_mod(MethodOverride):
_("Server will check DNS forwarder(s)."))
self.Backend.textui.print_plain(
_("This may take some time, please wait ..."))
+
+
+@register(override=True)
+class dns_update_system_records(CommandOverride):
+ def output_for_cli(self, textui, output, *args, **options):
+ output_super = copy.deepcopy(output)
+ super_res = output_super.get('result', {})
+ super_res.pop('ipa_records', None)
+ super_res.pop('location_records', None)
+
+ super(dns_update_system_records, self).output_for_cli(
+ textui, output_super, *args, **options)
+
+ labels = {
+ p.name: unicode(p.label) for p in self.output_params()
+ }
+
+ result = output.get('result', {})
+ for key in ('ipa_records', 'location_records'):
+ if result.get(key):
+ textui.print_indented(u'{}:'.format(labels[key]), indent=1)
+ for val in sorted(result[key]):
+ textui.print_indented(val, indent=2)
+ textui.print_line(u'')
+
+ return int(not output['value'])