URL: https://github.com/freeipa/freeipa/pull/3347 Author: flo-renaud Title: #3347: [Backport][ipa-4-6] dnsrecord-mod: allow to modify ttl without passing the record Action: opened
PR body: """ This PR was opened automatically because PR #3288 was pushed to master and backport to ipa-4-6 is required. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/3347/head:pr3347 git checkout pr3347
From 8e856225e4fd9f7952fe199e3d5bf845f22e7dfb Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud <f...@redhat.com> Date: Tue, 18 Jun 2019 15:43:46 +0200 Subject: [PATCH 1/2] dnsrecord-mod: allow to modify ttl without passing the record The command ipa dnsrecord-mod <zone> <record> --ttl requires to provide at least one record to modify. When none is specified, it prompts by proposing each of the existing records, for instance: ipa dnsrecord-mod ZZZZZ.org ns11 --ttl=86400 No option to modify specific record provided. Current DNS record contents: A record: xxx.xxx.xxx.xxx AAAA record: xxxx:xx Modify A record 'xxxx.xxxx.xxxx.xxxx'? Yes/No (default No): Modify AAAA record 'xxxx:xx'? Yes/No (default No): ipa: ERROR: No options to modify a specific record provided. The admin should be able to modify the TTL value without re-entering the record information. The issue happens because of an internal check that forgot to consider 'dnsttl' as a valid standalone modification. Fixes: https://pagure.io/freeipa/issue/7982 --- ipalib/dns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipalib/dns.py b/ipalib/dns.py index 95c7989b65..45f1eb67e8 100644 --- a/ipalib/dns.py +++ b/ipalib/dns.py @@ -55,7 +55,7 @@ def get_extra_rrtype(name): def has_cli_options(cmd, options, no_option_msg, allow_empty_attrs=False): - sufficient = ('setattr', 'addattr', 'delattr', 'rename') + sufficient = ('setattr', 'addattr', 'delattr', 'rename', 'dnsttl') if any(k in options for k in sufficient): return From 39b1cce683e6edaa1cf4f4713cde30b5f125adb5 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud <f...@redhat.com> Date: Tue, 18 Jun 2019 15:47:32 +0200 Subject: [PATCH 2/2] XMLRPC tests: add new test for ipa dsnrecord-mod $ZONE $RECORD --ttl The test suite did not have any test for modification of the TTL of an existing DNS record. Related: https://pagure.io/freeipa/issue/7982 --- ipatests/test_xmlrpc/test_dns_plugin.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ipatests/test_xmlrpc/test_dns_plugin.py b/ipatests/test_xmlrpc/test_dns_plugin.py index 7ecb39bb94..1c6dc6d242 100644 --- a/ipatests/test_xmlrpc/test_dns_plugin.py +++ b/ipatests/test_xmlrpc/test_dns_plugin.py @@ -1944,6 +1944,34 @@ def setup_class(cls): }, ), + dict( + desc='Modify ttl of record %r in zone %r' % (name1, zone1), + command=('dnsrecord_mod', [zone1, name1], {'dnsttl': 500}), + expected={ + 'value': name1_dnsname, + 'summary': None, + 'result': { + 'idnsname': [name1_dnsname], + 'dnsttl': ['500'], + 'arecord': [revname2_ip], + }, + }, + ), + + + dict( + desc='Delete ttl of record %r in zone %r' % (name1, zone1), + command=('dnsrecord_mod', [zone1, name1], {'dnsttl': None}), + expected={ + 'value': name1_dnsname, + 'summary': None, + 'result': { + 'idnsname': [name1_dnsname], + 'arecord': [revname2_ip], + }, + }, + ), + dict( desc='Try to add per-zone permission for unknown zone',
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org