Re: setting INTERACTIVITY back to "not set"?

Jean-Louis Martineau <[email protected]> Wed, 15 Nov 2017 07:34:11 -0500
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
Nathan,

I committed the attached patch to fix the 'no such parameter'issue.

Jean-Louis

On 14/11/17 06:01 PM, Nathan Stratton Treadway wrote:
> On Tue, Nov 14, 2017 at 12:59:42 -0500, Jean-Louis Martineau wrote:
> > Nathan,
> >
> > Can you try the attached patch?
>
> Yep, with the patch applied, I can successfully override to "not set" on
> the command line (both the global setting and per-storage):
>
> =====
> # su backup -lc 'amadmin TestBackup config' | egrep 
> "^[[:space:]]*INTERACT|DEFINE STORAGE"
> INTERACTIVITY "inter_tty_email"
> DEFINE STORAGE TestBackup {
> INTERACTIVITY "inter_tty_email"
> DEFINE STORAGE TestOffsite {
> INTERACTIVITY "inter_tty"
>
> # su backup -lc 'amadmin TestBackup config -ointeractivity=' | egrep 
> "^[[:space:]]*INTERACT|DEFINE STORAGE"
> INTERACTIVITY ""
> DEFINE STORAGE TestBackup {
> INTERACTIVITY ""
> DEFINE STORAGE TestOffsite {
> INTERACTIVITY "inter_tty"
>
>
> # su backup -c 'amcheck -s TestBackup -ostorage=TestOffsite'
> Amanda Tape Server Host Check
> -----------------------------
> NOTE: Holding disk '/amanda/TestBackup-holding': 413192 MB disk space 
> available, using 412992 MB
> ERROR: Failed to open /dev/tty: No such device or address
> Server check took 0.126 seconds
> (brought to you by Amanda 3.5)
>
> # su backup -c 'amcheck -s TestBackup -ostorage=TestOffsite 
> -ostorage:TestOffsite:interactivity='
> Amanda Tape Server Host Check
> -----------------------------
> NOTE: Holding disk '/amanda/TestBackup-holding': 413192 MB disk space 
> available, using 412992 MB
> ERROR: No acceptable volumes found
> Server check took 0.137 seconds
> (brought to you by Amanda 3.5)
> =====
>
> ... and also in the amanda.conf storage definition:
>
> =====
> # egrep -i "^[[:space:]]*INTERACT|DEFINE STORAGE" 
> /etc/amanda/TestBackup/amanda.conf
> interactivity "inter_tty_email"
> define storage TestBackup {
> define storage TestOffsite {
> interactivity ""
>
> # su backup -lc 'amadmin TestBackup config' | egrep 
> "^[[:space:]]*INTERACT|DEFINE STORAGE"
> INTERACTIVITY "inter_tty_email"
> DEFINE STORAGE TestBackup {
> INTERACTIVITY "inter_tty_email"
> DEFINE STORAGE TestOffsite {
> INTERACTIVITY ""
> =====
>
>
> However, in my testing I noticed that amgetconf treats a blank
> interactivity as "no such parameter". I don't remember off-hand
> how that worked before applying the patch, but it is different from
> other options:
>
> =====
> # su backup -lc 'amadmin TestBackup config' | egrep -A1
> "^[[:space:]]*INTERACT|DEFINE STORAGE"
> INTERACTIVITY "inter_tty_email"
> TAPERSCAN "taper_lexical"
> --
> DEFINE STORAGE TestBackup {
> COMMENT ""
> --
> INTERACTIVITY "inter_tty_email"
> SET-NO-REUSE no
> --
> DEFINE STORAGE TestOffsite {
> COMMENT ""
> --
> INTERACTIVITY ""
> SET-NO-REUSE no
>
> # amgetconf TestBackup storage:TestOffsite:comment
>
> # amgetconf TestBackup storage:TestOffsite:interactivity
> amgetconf: no such parameter "storage:TestOffsite:interactivity"
> =====
>
>
> Similarly for the global parameter (i.e. if I comment out all
> "interactivity" lines from my amanda.conf):
>
> =====
> ~# su backup -lc 'amadmin TestBackup config' | egrep 
> "^PRINTER|^INTERACTIVITY"
> PRINTER ""
> INTERACTIVITY ""
> # amgetconf TestBackup printer
>
> # amgetconf TestBackup interactivity
> amgetconf: no such parameter "interactivity"
> =====
>
>
> (Looks like amgetconf also gives "no such parameter" error for
> unset/empty taperscan and policy:
>
> =====
> # amgetconf TestBackup taperscan
> taper_lexical
> # amgetconf TestBackup taperscan -otaperscan=
> amgetconf: no such parameter "taperscan"
>
>
> # amgetconf TestBackup storage:TestBackup:policy
> TestBackup
> # amgetconf TestBackup storage:TestBackup:policy 
> -ostorage:TestBackup:policy=
> amgetconf: no such parameter "storage:TestBackup:policy"
> =====
>
> )
>
> Nathan
>
> ----------------------------------------------------------------------------
> Nathan Stratton Treadway - [email protected] - Mid-Atlantic region
> Ray Ontko & Co. - Software consulting services - http://www.ontko.com/ 
> <http://www.ontko.com/>
> GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt 
> <http://www.ontko.com/~nathanst/gpg_key.txt> 
> ID: 1023D/ECFB6239
> Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239
This message is the property of CARBONITE, INC. and may contain confidential or privileged information.
If this message has been delivered to you by mistake, then do not copy or deliver this message to anyone.  Instead, destroy it and notify me by reply e-mail
amgetconf-unset.diff (text/x-patch, 769 B)
diff --git a/common-src/amgetconf.pl b/common-src/amgetconf.pl
index 715c68f..fdb1a10 100644
--- a/common-src/amgetconf.pl
+++ b/common-src/amgetconf.pl
@@ -183,8 +183,8 @@ sub build_param {
     } else {
 	my ($pname) = $parameter =~ /^build\.(.*)/;
 
+	no_such_param($parameter) unless exists $build_info{lc $pname};
 	my $val = $build_info{lc $pname};
-	no_such_param($parameter) unless (defined($val));
 
 	print "$val\n";
     }
@@ -257,9 +257,9 @@ sub conf_param {
 	    print $properties{$propname}->{'values'}[0], "\n";
 	}
     } else {
-	no_such_param($parameter)
-	    unless defined(getconf_byname($parameter));
 	my @strs = getconf_byname_strs($parameter, 0);
+	no_such_param($parameter)
+	    unless @strs;
 
 	for my $str (@strs) {
 	    print "$str\n";