# vim:ft=perl
-# Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved.
+# Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
=item C<add_script($name, $values_arrayref)>
=item C<add_device($name, $values_arrayref)>
=item C<add_changer($name, $values_arrayref)>
+=item C<add_interactivity($name, $values_arrayref)>
+=item C<add_taperscan($name, $values_arrayref)>
Add the given subsection to the configuration file, including all values in the
arrayref. The values should be specified as alternating key/value pairs.
$self->_add_subsec("changers", $name, 1, $values);
}
+sub add_interactivity {
+ my $self = shift;
+ my ($name, $values) = @_;
+ $self->_add_subsec("interactivities", $name, 1, $values);
+}
+
+sub add_taperscan {
+ my $self = shift;
+ my ($name, $values) = @_;
+ $self->_add_subsec("taperscans", $name, 1, $values);
+}
+
=item C<add_text($text)>
Add arbitrary text to the config file.
# write key/value pairs
my @params = @{$self->{'params'}};
my $saw_tapetype = 0;
+ my $taperscan;
while (@params) {
$param = shift @params;
$value = shift @params;
+ if ($param eq 'taperscan') {
+ $taperscan = $value;
+ next;
+ }
print $amanda_conf "$param $value\n";
$saw_tapetype = 1 if ($param eq "tapetype");
}
$self->_write_amanda_conf_subsection($amanda_conf, "holdingdisk", $self->{"holdingdisks"});
$self->_write_amanda_conf_subsection($amanda_conf, "device", $self->{"devices"});
$self->_write_amanda_conf_subsection($amanda_conf, "changer", $self->{"changers"});
+ $self->_write_amanda_conf_subsection($amanda_conf, "interactivity", $self->{"interactivities"});
+ $self->_write_amanda_conf_subsection($amanda_conf, "taperscan", $self->{"taperscans"});
print $amanda_conf "\n", $self->{'text'}, "\n";
+ print $amanda_conf "taperscan $taperscan\n" if $taperscan;
close($amanda_conf);
}
$value = shift @values;
if ($param eq "inherit") {
print $amanda_conf "$value\n";
- } else {
+ } elsif (defined $value) {
print $amanda_conf "$param $value\n";
+ } else {
+ print $amanda_conf "$param\n";
}
}
print $amanda_conf "}\n";