source4/scripting: add an option to samba_dnsupdate to add ns records.

Richard Sharpe realrichardsharpe at gmail.com
Sun Jun 26 16:35:03 UTC 2016


On Sun, Jun 26, 2016 at 8:33 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> On Tue, Jun 21, 2016 at 3:39 PM, Andrew Bartlett <abartlet at samba.org> wrote:
>> On Tue, 2016-06-21 at 00:52 +0200, Jeremy Allison wrote:
>>> The branch, master has been updated
>>>        via  af08cb2 source4/scripting: add an option to
>>> samba_dnsupdate to add ns records.
>>>       from  7d9a876 ctdb-tests: Update local daemons tests to use
>>> CTDB_NOSETSCHED
>>>
>>> https://git.samba.org/?p=samba.git;a=shortlog;h=master
>>>
>>>
>>> - Log ---------------------------------------------------------------
>>> --
>>> commit af08cb2eee9dc9fabad6ca62ca11728209297222
>>> Author: Richard Sharpe <rsharpe at samba.org>
>>> Date:   Mon May 23 17:37:13 2016 -0700
>>>
>>>     source4/scripting: add an option to samba_dnsupdate to add ns
>>> records.
>>>
>>>     Add a --add-ns option to samba_dnsupdate and use that, but only
>>> when --use-file has been specified, to add an NS record to the file
>>> produced.
>>>
>>>     This allows us to make progress in the self tests and is an
>>> interim fix.
>>>
>>>     Signed-off-by: Richard Sharpe <rsharpe at samba.org>
>>>     Reviewed-by: Rowland Penny <repenny241155 at gmail.com>
>>>
>>>     Autobuild-User(master): Jeremy Allison <jra at samba.org>
>>>     Autobuild-Date(master): Tue Jun 21 00:51:02 CEST 2016 on sn-devel
>>> -144
>>>
>>> ---------------------------------------------------------------------
>>> --
>>>
>>> Summary of changes:
>>>  source4/scripting/bin/samba_dnsupdate | 10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>>
>>> Changeset truncated at 500 lines:
>>>
>>> diff --git a/source4/scripting/bin/samba_dnsupdate
>>> b/source4/scripting/bin/samba_dnsupdate
>>> index 16265f6..3880dda 100755
>>> --- a/source4/scripting/bin/samba_dnsupdate
>>> +++ b/source4/scripting/bin/samba_dnsupdate
>>> @@ -69,6 +69,7 @@ parser.add_option("--all-interfaces",
>>> action="store_true")
>>>  parser.add_option("--current-ip", action="append", help="IP address
>>> to update DNS to match (helpful if behind NAT, valid multiple times,
>>> defaults to values from interfaces=)")
>>>  parser.add_option("--rpc-server-ip", type="string", help="IP address
>>> of server to use with samba-tool (defaults to first --current-ip)")
>>>  parser.add_option("--use-file", type="string", help="Use a file,
>>> rather than real DNS calls")
>>> +parser.add_option("--add-ns", action="store_true", help="Add an NS
>>> record to the DNS file for self-tests. Can only be used with --use
>>> -file")
>>>  parser.add_option("--update-list", type="string", help="Add DNS
>>> names from the given file")
>>>  parser.add_option("--update-cache", type="string", help="Cache
>>> database of already registered records")
>>>  parser.add_option("--fail-immediately", action='store_true',
>>> help="Exit on first failure")
>>> @@ -681,6 +682,15 @@ dup_set = set()
>>>  cache_set = set()
>>>
>>>  rebuild_cache = False
>>> +
>>> +# Add an NS line if asked to ...
>>> +if opts.add_ns:
>>> +    if opts.use_file is None:
>>> +        print "Option --add-ns can only be used with --use-file"
>>> +        sys.exit(1)
>>> +    else:
>>> +        dns_list.append(parse_dns_line("NS ${DNSDOMAIN}
>>> ${HOSTNAME}", sub_vars))
>>> +
>>>  try:
>>>      cfile = open(dns_update_cache, 'r+')
>>>  except IOError:
>>
>> Why do we need this patch after we added it to the dns_update list?
>> https://git.samba.org/?p=samba.git;a=commitdiff;h=e3822497c87dade49ac85
>> 374e695f0a4f10bbc70  Is this because IF_RWDNS_DOMAIN is not set in one
>> of the environments?
>>
>> Which tests fail to proceed without this?
>>
>> Adding an extra command line option seems entirely wrong, shouldn't the
>> correct fix be to set IF_RWDNS_DOMAIN if --use-file is set?
>
> Sorry for the late reply.
>
> Let me kook at it again and see if the problem no longer exists with
> that commit.

You are correct. That change is totally unneeded. I have tested the
self test environment with it reverted and things work correctly. In
addition, that was not being called from anywhere anyway.

For some reason the repository I was using did not contain the change
you mentioned when I first started on this journey.

Attached is a patch to revert that change.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-source4-scripting-Revert-an-unneeded-change.patch
Type: text/x-patch
Size: 2021 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160626/a87ba1dd/0001-source4-scripting-Revert-an-unneeded-change.bin>


More information about the samba-technical mailing list