Bug 365 - Setting nsdc options in a configuration file
Setting nsdc options in a configuration file
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
3.2.x
All All
: P5 enhancement
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-07 00:00 CET by Anand Buddhdev
Modified: 2019-04-04 12:42 CEST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anand Buddhdev 2011-03-07 00:00:17 CET
The nsdc script has 2 configurable options: ZONEC_VERBOSE and PATCH_STYLE.

They have default values set, and the script suggests that a user can set change these to alter the behaviour of nsdc.

However, from a system administrator's viewpoint, this isn't an ideal situation. Even though nsdc is a script, to a sysadmin, it's just like any other binary, because it typically gets installed in /usr/sbin, for example. The general rule of system management is that if you want to tune the behaviour of installed packages, you do that by tuning options and parameters in config files, not by editing installed binaries.

Also when a package gets upgraded (using RPM or DEB for example), all files marked as binaries (including nsdc) will get overwritten. However, files such as nsd.conf, which are clearly configuration files, are not touched, as it is understood that a sysadmin will have changed those.

Therefore, I would like to see these 2 options in nsdc be configurable, rather than hard-coded as they are.

One way to do this is to make them options in nsd.conf. Since nsdc reads nsd.conf anyway, this makes perfect sense. Perhaps you can introduce a new section in nsd.conf, called "nsdc". Then it would look like this:

server:
  var1: value1
  var2: value2

zone:
  var1: value1
  var2: value2

nsdc:
  patch-style: <text|pipe>
  verbosity: <0|1|2>

Such a change would make tuning nsdc more friendly to sysadmins and package managers. I hope you will see the logic in this proposal and implement it in the next update to nsd.
Comment 1 Wouter Wijngaards 2011-03-08 09:28:52 CET
Hi Anand,

Yes you are right, it would be more neat to put the configuration in the config file and not inside an sbin file.

A nice solution like you propose takes a lot of code (comparing), and a more hacky solution like:
server:
   var1: val1

# this line must stay commented, but you can change the value for the
# nsdc.sh script: patch-style 1(textfiles, default), 0 (without).
# NSDC-PATCH-STYLE 1
# verbosity for zonec, nothing, -v or -vv
# NSDC-ZONEC-VERBOSE -v

This only needs a grep,sed in the nsdc, a two-line solution.

Best regards,
   Wouter
Comment 2 Anand Buddhdev 2011-03-08 14:04:44 CET
Hi Wouter,

I see merit in your idea, of keeping the config variables in nsd.conf comment lines. I suppose that for the 3.2.x branch, it's a reasonable compromise, as long as it's properly documented in the nsd.conf man page (otherwise it becomes an undocumented feature, which I don't like).

Hopefully, for NSD4, you'll consider implementing this as a proper variable (assuming such a feature exists in NSD4).

Regards,

Anand
Comment 3 Wouter Wijngaards 2011-03-25 08:30:26 CET
Hi Anand,

nsdc now has: NSDC_ZONEC_VERBOSE=${NSDC_ZONEC_VERBOSE:--v}
and NSDC_PATCH_STYLE=${NSDC_PATCH_STYLE:-1}

So you can set $NSDC_ZONEC_VERBOSE " " or -v or -vv in the environment as well as the NSDC_PATCH_STYLE.  For example:
NSDC_PATCH_STYLE=0 nsdc patch
in the cron job.

Best regards,
   Wouter
Comment 4 Matthijs Mekking 2011-05-13 11:01:53 CEST
Thou shall rename all the environment variable names in the nsdc shell script (fixed in r3335).
Comment 5 peterpen 2019-04-04 12:42:38 CEST
Trying this platform and play the best online free imvu free credits http://vucredits.com/ game that is the very funny and entertaining game here the more players play this game thanks.