view release on metacpan or search on metacpan
=head1 Enhancements
=head2 Boolean flags can be turned off, as well as on
If an argument to a method (and its corresponding command line
argument) doesn't take a value, it is treated like a Boolean flag.
However, the code used to assume that the existence of a Boolean key
in the argument list implied the Boolean argument was always true.
Now, the truth of the arguments I<value> is tested to determine if the
flag should be set on or off. This makes it easy to have subroutines
that just blindly pass certain arguments along, without haing to test
them, and allows for much cleaner code.
For example:
my $result = $vos->release
(
name => $name,
force => $force,
);
When a volume's status is "offline", there is really more than one
status the volume can be in. A volume might be unattached, and
offline, or it might be attached, but adminitratively offline. For
example, "vos offline" put a vlume in the latter state, and if for
some reason there are two volumes with the same ID on the same
fileserver, they will both be attached (if possible), but only the
first one encountered will be brought online.
Changing the value of status would been a non-backwards compatible
change, and caused some subtle problems for some applications. Rather
than introduce such a change, I have chosen to represent this state
with an additional attribute "attached", which is just a Boolean,
indicating whether or not the volume is attached.
=head1 Bugs
=head1 Changes in 1.5
=head1 Enhancements
attribute was changed to "accesses" to match the documentation, and
the string that is parsed in vos output.
=head1 Changes in 1.4
=head1 Enhancements
=head2 Test suite is disabled by default.
There is a well intentioned effort to automatically test all new
submissions to CPAN (see http://testers.cpan.org). Unfortunately, the
AFS-Command package can't be tested automatically, since it requires a
fair amount of configuration. You have to specify a cell name, some
fileserver names and partitions, etc.
By default, the tests will all be skipped if the configured cell name
in the CONFIG file has not been modified, thus allowing the automated
CPAN testing to continue, automatically, without the author getting a
bunch of bogus emails.
=head1 Bugs
Changes.html view on Meta::CPAN
</A></H2>
If an argument to a method (and its corresponding command line argument)
doesn't take a value, it is treated like a Boolean flag. However, the code
used to assume that the existence of a Boolean key in the argument list
implied the Boolean argument was always true.
<P>
Now, the truth of the arguments <EM>value</EM> is tested to determine if the flag should be set on or off. This makes it
easy to have subroutines that just blindly pass certain arguments along,
without haing to test them, and allows for much cleaner code.
<P>
For example:
<P>
Changes.html view on Meta::CPAN
might be attached, but adminitratively offline. For example, ``vos
offline'' put a vlume in the latter state, and if for some reason there are
two volumes with the same ID on the same fileserver, they will both be
attached (if possible), but only the first one encountered will be brought
online.
<P>
Changing the value of status would been a non-backwards compatible change,
and caused some subtle problems for some applications. Rather than
introduce such a change, I have chosen to represent this state with an
additional attribute ``attached'', which is just a Boolean, indicating
whether or not the volume is attached.
<P>
<P>
<HR>
<H1><A NAME="Bugs">Bugs
Changes.html view on Meta::CPAN
<HR>
<H1><A NAME="Enhancements">Enhancements
</A></H1>
<P>
<HR>
<H2><A NAME="Test_suite_is_disabled_by_defaul">Test suite is disabled by default.
</A></H2>
There is a well intentioned effort to automatically test all new
submissions to CPAN (see <A
HREF="http://testers.cpan.org).">http://testers.cpan.org).</A>
Unfortunately, the AFS-Command package can't be tested automatically, since
it requires a fair amount of configuration. You have to specify a cell
name, some fileserver names and partitions, etc.
<P>
By default, the tests will all be skipped if the configured cell name in
the CONFIG file has not been modified, thus allowing the automated CPAN
under the copyright of this Package, but belong to whoever
generated them, and may be sold commercially, and may be aggregated
with this Package. If such scripts or library files are aggregated
with this Package via the so-called "undump" or "unexec" methods of
producing a binary executable image, then distribution of such an
image shall neither be construed as a distribution of this Package
nor shall it fall under the restrictions of Paragraphs 3 and 4,
provided that you do not represent such an executable image as a
Standard Version of this Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines
donot change the language in any way that would cause it to fail
the regression tests for the language.
8. Aggregation of this Package with a commercial distribution is
always permitted provided that the use of this Package is embedded;
that is, when no overt attempt is made to make this Package's
interfaces visible to the end user of the commercial distribution.
Such use shall not be construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or
lib/AFS/Command.pod view on Meta::CPAN
=head2 AFS::Object
This is the base class for the objects returned from the command
methods that encapsulate some form of structured data. Many of the
methods return simple boolean true/false values (either the command
worked, or it failed), with no need for any special objects, so we
don't create them. Anything that has to return interesting data uses
this class, or one of its base classes.
The subclasses are associated with data structures such as volume
headers, a VLDB entry, or a partition on a server. Each of these
classes has methods to retrieve the objects they "contain", such as a
method to query the list of volume names on a partition object, and a
method to get a list of VLDB entries from a VLDB site.
The data structures, and their varying relationships, are documented
in details of the methods for each of the commands, and the specific
interfaces for each object type are documented in the corresponding
class documentation.
The subclasses for encapsulating the VLDB data are:
AFS::Object::VLDB
AFS::Object::VLDBEntry
AFS::Object::VLDBSite
The subclasses for encapsulating the volume headers are:
AFS::Object::FileServer
AFS::Object::VolServer
AFS::Object::Partition
AFS::Object::Volume
AFS::Object::VolumeHeader
The subclasses for encapsulating the bosserver data are:
AFS::Object::BosServer
AFS::Object::Instance
Note that none of these classes are specifically documented, since the
structure of the classes is subject to change. The API for accessin
the results of any given AFS command (eg. vos listvol) is considered
reasonably stable, but the encapsulation may change radically.
Don't get too attached to these class names, because they will likely
be rearranged in a future release.
=cut
lib/AFS/Command/BOS.pm view on Meta::CPAN
use English;
use AFS::Command::Base;
use AFS::Object;
use AFS::Object::BosServer;
use AFS::Object::Instance;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub getdate {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getdate";
my $directory = $args{dir} || '/usr/afs/bin';
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getlog {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getlog";
my $redirect = undef;
my $redirectname = undef;
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getrestart {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getrestart";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listhosts {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listhosts";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
$result->_setAttribute( hosts => \@hosts );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listkeys {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listkeys";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listusers {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listusers";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
return if $errors;
return $result;
}
#
# XXX -- we might want to provide parsing of the bos salvage output,
# but for now, this is a non-parsed command.
#
# sub salvage {
# my $self = shift;
# my (%args) = @_;
# my $result = AFS::Object::BosServer->new();
# $self->{operation} = "salvage";
# return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
# }
# $errors++ unless $self->_reap_cmds();
# $errors++ unless $self->_restore_stderr();
# return if $errors;
# return $result;
# }
sub status {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "status";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/Base.pm view on Meta::CPAN
our $AUTOLOAD = "";
our $VERSION = '1.99';
our %Carp =
(
carp => \&Carp::carp,
croak => \&Carp::croak,
);
sub setCarp {
my $class = shift;
my (%args) = @_;
foreach my $key ( keys %args ) {
unless ( $Carp{$key} ) {
croak("Unsupported argument: '$key'");
}
unless ( ref $args{$key} eq 'CODE' ) {
croak("Not a code reference: '$args{$key}'");
}
$Carp{$key} = $args{$key};
}
return AFS::Object->_setCarp(@_);
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my %args = @_;
my $self = {};
foreach my $key ( qw( localtime noauth localauth encrypt quiet timestamps ) ) {
$self->{$key}++ if $args{$key};
}
lib/AFS/Command/Base.pm view on Meta::CPAN
} else {
@{$self->{command}} = lc((split(/::/,$class))[2]);
}
bless $self, $class;
return $self;
}
sub errors {
my $self = shift;
return $self->{errors};
}
sub supportsOperation {
my $self = shift;
my $operation = shift;
return $self->_operations($operation);
}
sub supportsArgument {
my $self = shift;
my $operation = shift;
my $argument = shift;
return unless $self->_operations($operation);
return unless $self->_arguments($operation);
return exists $self->{_arguments}->{$operation}->{$argument};
}
sub _Carp {
my $self = shift;
$Carp{carp}->(@_);
}
sub _Croak {
my $self = shift;
$Carp{croak}->(@_);
}
sub _operations {
my $self = shift;
my $operation = shift;
my $class = ref $self;
unless ( $self->{_operations} ) {
my %operations = ();
lib/AFS/Command/Base.pm view on Meta::CPAN
}
$self->{_operations} = \%operations;
}
return $self->{_operations}->{$operation};
}
sub _arguments {
my $self = shift;
my $operation = shift;
my $arguments =
{
optional => {},
required => {},
aliases => {},
};
lib/AFS/Command/Base.pm view on Meta::CPAN
if ( $? ) {
$self->_Carp("Error running @command $operation -help. Unable to configure @command $operation");
$errors++;
}
return if $errors;
return $self->{_arguments}->{$operation} = $arguments;
}
sub _save_stderr {
my $self = shift;
$self->{olderr} = IO::File->new(">&STDERR") || do {
$self->_Carp("Unable to dup stderr: $ERRNO");
return;
};
my $command = basename((split /\s+/,@{$self->{command}})[0]);
lib/AFS/Command/Base.pm view on Meta::CPAN
$newerr->close() || do {
$self->_Carp("Unable to close $self->{tmpfile}: $ERRNO");
return;
};
return 1;
}
sub _restore_stderr {
my $self = shift;
STDERR->fdopen( $self->{olderr}->fileno(), "w") || do {
$self->_Carp("Unable to restore stderr: $ERRNO");
return;
};
$self->{olderr}->close() || do {
$self->_Carp("Unable to close saved stderr: $ERRNO");
lib/AFS/Command/Base.pm view on Meta::CPAN
$self->_Carp("Unable to unlink $self->{tmpfile}: $ERRNO");
return;
};
delete $self->{tmpfile};
return 1;
}
sub _parse_arguments {
my $self = shift;
my $class = ref($self);
my (%args) = @_;
my $arguments = $self->_arguments($self->{operation});
unless ( defined $arguments ) {
$self->_Carp("Unable to obtain arguments for $class->$self->{operation}");
return;
lib/AFS/Command/Base.pm view on Meta::CPAN
}
push( @{$self->{cmds}}, \@argv );
}
return 1;
}
sub _exec_cmds {
my $self = shift;
my %args = @_;
my @cmds = @{$self->{cmds}};
$self->{pids} = {};
for ( my $index = 0 ; $index <= $#cmds ; $index++ ) {
lib/AFS/Command/Base.pm view on Meta::CPAN
$self->{handle} = $pipe->reader();
$self->{pids}->{$pid} = $cmd;
}
return 1;
}
sub _parse_output {
my $self = shift;
$self->{errors} = "";
while ( defined($_ = $self->{handle}->getline()) ) {
$self->{errors} .= time2str("[%Y-%m-%d %H:%M:%S] ",time,'GMT') if $self->{timestamps};
$self->{errors} .= $_;
}
return 1;
}
sub _reap_cmds {
my $self = shift;
my (%args) = @_;
my $errors = 0;
$self->{handle}->close() || do {
$self->_Carp("Unable to close pipe handle: $ERRNO");
$errors++;
};
lib/AFS/Command/Base.pm view on Meta::CPAN
$errors++;
}
}
return if $errors;
return 1;
}
sub AUTOLOAD {
my $self = shift;
my (%args) = @_;
$self->{operation} = $AUTOLOAD;
$self->{operation} =~ s/.*:://;
return unless $self->_parse_arguments(%args);
return unless $self->_exec_cmds( stderr => 'stdout' );
lib/AFS/Command/Base.pm view on Meta::CPAN
my $errors = 0;
$errors++ unless $self->_parse_output();
$errors++ unless $self->_reap_cmds();
return if $errors;
return 1;
}
sub DESTROY {}
1;
lib/AFS/Command/Base.pod view on Meta::CPAN
that perl excels in.
This document covers general programming with the API, and the details
of the specific wrapper classes are documented separately
(eg. AFS::Command::VOS).
=head1 CLASS METHODS
=head2 new
All of the AFS::Command subclasses use this inherited method as an
object constructor. In its simplest usage, it can be called with no
arguments, but there are several which control global behavior of the
commands, simplifying subsequent coding a bit.
=over
=item command
This key has the pathname to the command to be used for execution. By
default, this is the simple command name "vos", "bos", etc, and the
command will simply be found in your $PATH by exec().
If you want to run a specific version of vos not found in the $PATH,
lib/AFS/Command/Base.pod view on Meta::CPAN
command => "/ms/dist/openafs/PROJ/core/1.2.9/bin/vos",
);
If the path given is invalid, then expect the API to implode on itself
when it can't be found, or it isn't an AFS vos command.
=item localauth, noauth, encrypt
All of these arguments correspond to command line arguments common
across the entire command line suite. Typically, if an application
uses this flag once, it will be using it for B<all> subsequent calls as
well. Therefore, the state of these flags can be set globally by
setting them when creating the command object.
my $vos = AFS::Command::VOS->new
(
localauth => 1,
encrypt => 1,
);
NOTE: The encrypt option is only available in more recent versions of
lib/AFS/Command/Base.pod view on Meta::CPAN
time required for each step in these complex operations.
This only applies to commands that return simple return values, eg:
release, restore, etc. Commands that return complex structures of
objects, such as listvldb, listvol, etc will not be affected.
=back
=head2 setCarp
This class method configures the carp and/or croak subroutines used
throughout the API. By default, the obviously sensible thing is done:
the carp an croak subroutines exported by the Carp module are used.
These normally print output to stderr, and this method provides a
mechanism for trapping these errors and redirecting them elsewhere.
For example, stderr in a system daemon may be entirely ignored, and
syslog may be a more appropriate destination. In this case, the
setCarp method may be used to configure this, globally, for the entire
API.
AFS::Command->setCarp
(
carp => sub {
my ($lines) = @_;
foreach my $line ( split(/\n+/,$lines) ) {
syslog('warning',$line);
}
},
croak => sub {
my ($lines) = @_;
foreach my $line ( split(/\n+/,$lines) ) {
syslog('error',$line);
}
die $lines; # If we're dying, whine at stderr, too.
},
);
This method takes a list of key/value pairs, with only two supported
keys (anything else will be quietly ignored): carp an croak. The
values are CODE references (anonymous subroutines, or references to
existing subroutines). The carp CODE should not be fatal, however the
croak CODE should. The API calls the croak method in very few places,
but when it does, it assumes that call will be fatal, so if you
provide a croak subroutine that doesn't die, the results will be
unpredictable, and unsupportable.
This method returns true of false, depending on whether or not the
carp and/or croak subroutines were properly configured. If the values
are not CODE references, then this method will itself croak.
=head1 INSTANCE METHODS
=head2 errors
This method takes no arguments, and it returns a string, containing the
unparsed errors from the last command method invoked. This string is
reset with each subsequent command method invocation. The string is
normally the output written to stderr by the process, but in the case
of unparsed boolean commands, it contains both the stdout as well as
the stderr output.
my $result = $vos->examine
(
id => $volname,
cell => $cell,
);
unless ( $result ) {
lib/AFS/Command/FS.pm view on Meta::CPAN
use AFS::Object;
use AFS::Object::CacheManager;
use AFS::Object::Path;
use AFS::Object::Cell;
use AFS::Object::Server;
use AFS::Object::ACL;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub checkservers {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "checkservers";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$result->_setAttribute( servers => \@servers );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub diskfree {
my $self = shift;
return $self->_paths_method('diskfree',@_);
}
sub examine {
my $self = shift;
return $self->_paths_method('examine',@_);
}
sub listquota {
my $self = shift;
return $self->_paths_method('listquota',@_);
}
sub quota {
my $self = shift;
return $self->_paths_method('quota',@_);
}
sub storebehind {
my $self = shift;
return $self->_paths_method('storebehind',@_);
}
sub whereis {
my $self = shift;
return $self->_paths_method('whereis',@_);
}
sub whichcell {
my $self = shift;
return $self->_paths_method('whichcell',@_);
}
sub listacl {
my $self = shift;
return $self->_paths_method('listacl',@_);
}
sub _paths_method {
my $self = shift;
my $operation = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = $operation;
my $pathkey = $operation eq 'storebehind' ? 'files' : 'path';
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds( allowstatus => 1 );
return if $errors;
return $result;
}
sub exportafs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object->new();
$self->{operation} = "exportafs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
/strict \'?passwd sync\'?/ && do {
$result->_setAttribute( uidcheck => 1 );
};
/no \'?passwd sync\'?/ && do {
$result->_setAttribute( uidcheck => 0 );
};
/allow mounts/i && do {
$result->_setAttribute( submounts => 1 );
};
/Only mounts/i && do {
$result->_setAttribute( submounts => 0 );
};
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcacheparms {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcacheparms";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcellstatus {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcellstatus";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getclientaddrs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getclientaddrs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$result->_setAttribute( addresses => \@addresses );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcrypt {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcrypt";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getserverprefs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getserverprefs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listaliases {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "listaliases";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listcells {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "listcells";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub lsmount {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "lsmount";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds( allowstatus => 1 );
return if $errors;
return $result;
}
#
# This is deprecated in newer versions of OpenAFS
#
sub monitor {
my $self = shift;
$self->_Carp("fs monitor: This operation is deprecated and no longer supported");
return;
}
sub sysname {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "sysname";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub wscell {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "wscell";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pod view on Meta::CPAN
=over
=item Arguments
The fs help string is:
fs exportafs: enable/disable translators to AFS
Usage: fs exportafs -type <exporter name> [-start <start/stop translator (on | off)>]
[-convert <convert from afs to unix mode (on | off)>]
[-uidcheck <run on strict 'uid check' mode (on | off)>]
[-submounts <allow nfs mounts to subdirs of /afs/.. (on | off)>]
The corresponding method invocation looks like:
my $result = $fs->exportafs
(
# Required arguments
type => $type, # 'nfs' is the only supported value
# Optional arguments
start => $start, # 'on' or 'off'
convert => $convert, # 'on' or 'off'
uidcheck => $uidcheck, # 'on' or 'off'
submounts => $submounts, # 'on' or 'off'
);
NOTE: In a future release, the 4 optional arguments will probably take
boolean values, with "off" being a special case that means false, in
order to simply the interface (and be backwards compatible).
=item Return Values
This method returns an AFS::Object::CacheManager object with one or
more attributes.
my $result = $fs->exportafs
(
type => 'nfs',
start => 'on',
) || die $fs->errors();
foreach my $attr ( qw( convert uidcheck submounts ) ) {
print "Translator has '$attr' set to '" . $result->$attr() . "'\n";
}
The object has the following attribute:
B<AFS::Object::CacheManager>
Attributes Values
---------- ------
enabled Boolean, true means the translator is on, false means off
convert Boolean, true means mode bits are converted from AFS to UNIX, false means off
uidcheck Boolean, true means strict uid checking mode is on, false means off
submounts Boolean, true means mounts of subdirs are allowed, false means disallowed
=back
=head2 getcacheparms
=over
=item Arguments
The fs help string is:
lib/AFS/Command/PTS.pm view on Meta::CPAN
use AFS::Command::Base;
use AFS::Object;
use AFS::Object::PTServer;
use AFS::Object::Principal;
use AFS::Object::Group;
use AFS::Object::User;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub creategroup {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "creategroup";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub createuser {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "createuser";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub examine {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "examine";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listentries {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listentries";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listmax {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listmax";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listowned {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listowned";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
$result->_addUser($user) if $user;
$result->_addGroup($group) if $group;
$errors++ unless $self->_reap_cmds();
return if $errors;
return $result;
}
sub membership {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "membership";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
use AFS::Object::Volume;
use AFS::Object::VolumeHeader;
use AFS::Object::VolServer;
use AFS::Object::FileServer;
use AFS::Object::Partition;
use AFS::Object::Transaction;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub examine {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::Volume->new();
my $entry = AFS::Object::VLDBEntry->new( locked => 0 );
$self->{operation} = "examine";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listaddrs {
my $self = shift;
my (%args) = @_;
my @result = ();
$self->{operation} = "listaddrs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return @result;
}
sub listpart {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::FileServer->new();
$self->{operation} = "listpart";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listvldb {
my $self = shift;
my (%args) = @_;
$self->{operation} = "listvldb";
my $locked = 0;
my $result = AFS::Object::VLDB->new();
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listvol {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::VolServer->new();
$self->{operation} = "listvol";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub partinfo {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::FileServer->new();
$self->{operation} = "partinfo";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub status {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::VolServer->new();
$self->{operation} = "status";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub dump {
my $self = shift;
my (%args) = @_;
$self->{operation} = 'dump';
my $file = delete $args{file} || do {
$self->_Carp("Missing required argument: 'file'");
return;
};
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return 1;
}
sub restore {
my $self = shift;
my (%args) = @_;
$self->{operation} = "restore";
my $file = delete $args{file} || do {
$self->_Carp("Missing required argument: 'file'");
return;
};
lib/AFS/Object.pm view on Meta::CPAN
our $AUTOLOAD = "";
our $VERSION = '1.99';
our %Carp =
(
carp => \&Carp::carp,
croak => \&Carp::croak,
);
sub _setCarp {
my $class = shift;
my (%args) = @_;
foreach my $key ( keys %args ) {
$Carp{$key} = $args{$key};
}
return 1;
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = { _attrs => { @_ } };
return bless $self, $class;
}
sub listAttributes {
my $self = shift;
return keys %{$self->{_attrs}};
}
sub getAttribute {
my $self = shift;
my $attr = shift;
return $self->{_attrs}->{$attr};
}
sub getAttributes {
my $self = shift;
my $attr = shift;
return %{$self->{_attrs}};
}
sub hasAttribute {
my $self = shift;
my $attr = shift;
return exists $self->{_attrs}->{$attr};
}
sub _Carp {
my $self = shift;
$Carp{carp}->(@_);
}
sub _Croak {
my $self = shift;
$Carp{croak}->(@_);
}
sub _setAttribute {
my $self = shift;
my (%attrs) = @_;
foreach my $attr ( keys %attrs ) {
$self->{_attrs}->{$attr} = $attrs{$attr};
}
return 1;
}
sub DESTROY {}
sub AUTOLOAD {
my $self = shift;
my $attr = $AUTOLOAD;
$attr =~ s/.*:://;
return $self->{_attrs}->{$attr};
}
1;
lib/AFS/Object.pod view on Meta::CPAN
=head1 DESCRIPTION
This class is used by the various AFS::Command classes to encapsulate
data returned from any command that has structured return values. In
the simplest case, this object just encapsulates a simple list of
key/value pairs. Each distinct key is represented as an object
attribute, and is query-able via one of several methods documented
below.
There are numerous subclasses of this class, which are used when
objects must contains other objects, and these subclasses just
implement special methods for querying the embedded objects.
=head1 METHODS
In all of the example code snippets below, $result is assumed to be an
AFS::Object object, or an object derived from it.
=head2 listAttributes
This method takes no arguments, and returns a list of the attribute
lib/AFS/Object/ACL.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::ACL;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPrincipals {
my $self = shift;
return unless ref $self->{_principals};
return keys %{$self->{_principals}};
}
sub getRights {
my $self = shift;
my $principal = shift;
return unless ref $self->{_principals};
return $self->{_principals}->{lc($principal)};
}
sub getEntries {
my $self = shift;
return unless ref $self->{_principals};
return %{$self->{_principals}};
}
sub _addEntry {
my $self = shift;
my $principal = shift;
my $rights = shift;
return $self->{_principals}->{$principal} = $rights;
}
1;
lib/AFS/Object/BosServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::BosServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getInstanceNames {
my $self = shift;
return unless ref $self->{_instances};
return keys %{$self->{_instances}};
}
sub getInstance {
my $self = shift;
my $name = shift;
return unless ref $self->{_instances};
return $self->{_instances}->{$name};
}
sub getInstances {
my $self = shift;
return unless ref $self->{_instances};
return values %{$self->{_instances}};
}
sub _addInstance {
my $self = shift;
my $instance = shift;
unless ( ref $instance && $instance->isa("AFS::Object::Instance") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Instance object");
}
return $self->{_instances}->{$instance->instance()} = $instance;
}
sub getFileNames {
my $self = shift;
return unless ref $self->{_files};
return keys %{$self->{_files}};
}
sub getFile {
my $self = shift;
my $filename = shift;
return unless ref $self->{_files};
return $self->{_files}->{$filename};
}
sub getFiles {
my $self = shift;
return unless ref $self->{_files};
return values %{$self->{_files}};
}
sub _addFile {
my $self = shift;
my $file = shift;
unless ( ref $file && $file->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_files}->{$file->file()} = $file;
}
sub getKeyIndexes {
my $self = shift;
return unless ref $self->{_keys};
return keys %{$self->{_keys}};
}
sub getKey {
my $self = shift;
my $index = shift;
return unless ref $self->{_keys};
return $self->{_keys}->{$index};
}
sub getKeys {
my $self = shift;
return unless ref $self->{_keys};
return values %{$self->{_keys}};
}
sub _addKey {
my $self = shift;
my $key = shift;
unless ( ref $key && $key->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_keys}->{$key->index()} = $key;
}
1;
lib/AFS/Object/CacheManager.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::CacheManager;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPathNames {
my $self = shift;
return unless ref $self->{_pathnames};
return keys %{$self->{_pathnames}};
}
sub getPaths {
my $self = shift;
return unless ref $self->{_pathnames};
return values %{$self->{_pathnames}};
}
sub getPath {
my $self = shift;
my $path = shift;
return unless ref $self->{_pathnames};
return $self->{_pathnames}->{$path};
}
sub _addPath {
my $self = shift;
my $path = shift;
unless ( ref $path && $path->isa("AFS::Object::Path") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Path object");
}
return $self->{_pathnames}->{$path->path()} = $path;
}
sub getCellNames {
my $self = shift;
return unless ref $self->{_cells};
return keys %{$self->{_cells}};
}
sub getCells {
my $self = shift;
return unless ref $self->{_cells};
return values %{$self->{_cells}};
}
sub getCell {
my $self = shift;
my $cell = shift;
return unless ref $self->{_cells};
return $self->{_cells}->{$cell};
}
sub _addCell {
my $self = shift;
my $cell = shift;
unless ( ref $cell && $cell->isa("AFS::Object::Cell") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Cell object");
}
return $self->{_cells}->{$cell->cell()} = $cell;
}
sub getServerNames {
my $self = shift;
return unless ref $self->{_servers};
return keys %{$self->{_servers}};
}
sub getServers {
my $self = shift;
return unless ref $self->{_servers};
return values %{$self->{_servers}};
}
sub getServer {
my $self = shift;
my $server = shift;
return unless ref $self->{_servers};
return $self->{_servers}->{$server};
}
sub _addServer {
my $self = shift;
my $server = shift;
unless ( ref $server && $server->isa("AFS::Object::Server") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Server object");
}
return $self->{_servers}->{$server->server()} = $server;
}
1;
lib/AFS/Object/FileServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::FileServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPartitionNames {
my $self = shift;
return unless ref $self->{_partitions};
return keys %{$self->{_partitions}};
}
sub getPartitions {
my $self = shift;
return unless ref $self->{_partitions};
return values %{$self->{_partitions}};
}
sub getPartition {
my $self = shift;
my $partname = shift;
return unless ref $self->{_partitions};
return $self->{_partitions}->{$partname};
}
sub _addPartition {
my $self = shift;
my $partition = shift;
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Partition object");
}
return $self->{_partitions}->{$partition->partition()} = $partition;
}
1;
lib/AFS/Object/Instance.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Instance;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getCommandIndexes {
my $self = shift;
return unless ref $self->{_commands};
return sort keys %{$self->{_commands}};
}
sub getCommands {
my $self = shift;
return unless ref $self->{_commands};
return values %{$self->{_commands}};
}
sub getCommand {
my $self = shift;
my $index = shift;
return unless ref $self->{_commands};
return $self->{_commands}->{$index};
}
sub _addCommand {
my $self = shift;
my $command = shift;
unless ( ref $command && $command->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_commands}->{$command->index()} = $command;
}
1;
lib/AFS/Object/PTServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::PTServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getGroupNames {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return keys %{$self->{_groups}->{_byName}};
}
sub getGroupIds {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byId};
return keys %{$self->{_groups}->{_byId}};
}
sub getGroups {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return values %{$self->{_groups}->{_byName}};
}
sub getGroupByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return $self->{_groups}->{_byName}->{lc($name)};
}
sub getGroupById {
my $self = shift;
my $id = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byId};
return $self->{_groups}->{_byId}->{$id};
}
sub getGroup {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/PTServer.pm view on Meta::CPAN
return $self->{_groups}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return $self->{_groups}->{_byName}->{lc($args{name})};
}
}
sub _addGroup {
my $self = shift;
my $group = shift;
unless ( ref $group && $group->isa("AFS::Object::Group") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Group object");
}
if ( $group->hasAttribute('name') ) {
my $name = $group->name();
lib/AFS/Object/PTServer.pm view on Meta::CPAN
$self->{_groups}->{_byId}->{$id} = $group;
} else {
$self->_Croak("Group has no id attribute!!\n" .
Data::Dumper->Dump([$group],['group']));
}
return 1;
}
sub getUserNames {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return keys %{$self->{_users}->{_byName}};
}
sub getUserIds {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byId};
return keys %{$self->{_users}->{_byId}};
}
sub getUsers {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return values %{$self->{_users}->{_byName}};
}
sub getUserByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return $self->{_users}->{_byName}->{lc($name)};
}
sub getUserById {
my $self = shift;
my $id = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byId};
return $self->{_users}->{_byId}->{$id};
}
sub getUser {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/PTServer.pm view on Meta::CPAN
return $self->{_users}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return $self->{_users}->{_byName}->{lc($args{name})};
}
}
sub _addUser {
my $self = shift;
my $user = shift;
unless ( ref $user && $user->isa("AFS::Object::User") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::User object");
}
if ( $user->hasAttribute('name') ) {
my $name = $user->name();
lib/AFS/Object/Partition.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Partition;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeIds {
my $self = shift;
return unless ref $self->{_headers};
return keys %{$self->{_headers}->{_byId}};
}
sub getVolumeNames {
my $self = shift;
return unless ref $self->{_headers};
return keys %{$self->{_headers}->{_byName}};
}
sub getVolumeHeaderById {
my $self = shift;
my $id = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byId};
return $self->{_headers}->{_byId}->{$id};
}
sub getVolumeHeaderByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byName};
return $self->{_headers}->{_byName}->{$name};
}
sub getVolumeHeaders {
my $self = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byId};
return values %{$self->{_headers}->{_byId}};
}
sub getVolumeHeader {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/Partition.pm view on Meta::CPAN
return $self->{_headers}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_headers} && ref $self->{_headers}->{_byName};
return $self->{_headers}->{_byName}->{$args{name}};
}
}
sub _addVolumeHeader {
my $self = shift;
my $header = shift;
unless ( ref $header && $header->isa("AFS::Object::VolumeHeader") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VolumeHeader object");
}
if ( $header->hasAttribute('name') ) {
$self->{_headers}->{_byName}->{$header->name()} = $header;
lib/AFS/Object/Path.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Path;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getACL {
my $self = shift;
my $type = shift || 'normal';
return unless ref $self->{_acl};
return $self->{_acl}->{"_$type"};
}
sub getACLNormal {
my $self = shift;
return $self->getACL();
}
sub getACLNegative {
my $self = shift;
return $self->getACL('negative');
}
sub _setACLNormal {
my $self = shift;
my $acl = shift;
unless ( ref $acl && $acl->isa("AFS::Object::ACL") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::ACL object");
}
return $self->{_acl}->{_normal} = $acl;
}
sub _setACLNegative {
my $self = shift;
my $acl = shift;
unless ( ref $acl && $acl->isa("AFS::Object::ACL") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::ACL object");
}
return $self->{_acl}->{_negative} = $acl;
lib/AFS/Object/Principal.pm view on Meta::CPAN
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Principal;
use strict;
our $VERSION = '1.99';
sub _addOwned {
my $self = shift;
my $owned = shift;
return $self->{_owned}->{$owned}++;
}
sub getOwned {
my $self = shift;
return unless ref $self->{_owned};
return keys %{$self->{_owned}};
}
sub _addMembership {
my $self = shift;
my $membership = shift;
return $self->{_membership}->{$membership}++;
}
sub getMembership {
my $self = shift;
return unless ref $self->{_membership};
return keys %{$self->{_membership}};
}
1;
lib/AFS/Object/VLDB.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VLDB;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeNames {
my $self = shift;
return unless ref $self->{_names};
return keys %{$self->{_names}};
}
sub getVolumeIds {
my $self = shift;
return unless ref $self->{_ids};
return keys %{$self->{_ids}};
}
sub getVLDBEntry {
my $self = shift;
my %args = ();
if ( $#_ == 0 ) {
if ( $^W ) {
$self->_Carp("WARNING: getVLDBEntry(\$name) usage is deprecated\n" .
"Use getVLDBENtryByName(\$name), or getVLDBERntry( name => \$name )\n");
}
lib/AFS/Object/VLDB.pm view on Meta::CPAN
return $self->{_ids}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_names};
return $self->{_names}->{$args{name}};
}
}
sub getVLDBEntryByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_names};
return $self->{_names}->{$name};
}
sub getVLDBEntryById {
my $self = shift;
my $id = shift;
return unless ref $self->{_ids};
return $self->{_ids}->{$id};
}
sub getVLDBEntries {
my $self = shift;
return unless ref $self->{_names};
return values %{$self->{_names}};
}
sub _addVLDBEntry {
my $self = shift;
my $entry = shift;
unless ( ref $entry && $entry->isa("AFS::Object::VLDBEntry") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBEntry object");
}
foreach my $id ( $entry->rwrite(), $entry->ronly(),
$entry->backup(), $entry->rclone() ) {
lib/AFS/Object/VLDBEntry.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VLDBEntry;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVLDBSites {
my $self = shift;
return unless ref $self->{_sites};
return @{$self->{_sites}};
}
sub _addVLDBSite {
my $self = shift;
my $site = shift;
unless ( ref $site && $site->isa("AFS::Object::VLDBSite") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBSite object");
}
return push( @{$self->{_sites}}, $site );
}
1;
lib/AFS/Object/VolServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VolServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPartitionNames {
my $self = shift;
return unless ref $self->{_partitions};
return keys %{$self->{_partitions}};
}
sub getPartitions {
my $self = shift;
return unless ref $self->{_partitions};
return values %{$self->{_partitions}};
}
sub getPartition {
my $self = shift;
my $partname = shift;
return unless ref $self->{_partitions};
return $self->{_partitions}->{$partname};
}
sub _addPartition {
my $self = shift;
my $partition = shift;
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Partition object");
}
return $self->{_partitions}->{$partition->partition()} = $partition;
}
sub getTransactions {
my $self = shift;
return unless ref $self->{_volumes};
return values %{$self->{_volumes}};
}
sub getVolumes {
my $self = shift;
return unless ref $self->{_volumes};
return keys %{$self->{_volumes}};
}
sub getTransactionByVolume {
my $self = shift;
my $volume = shift;
return unless ref $self->{_volumes};
return $self->{_volumes}->{$volume};
}
sub _addTransaction {
my $self = shift;
my $transaction = shift;
unless ( ref $transaction && $transaction->isa("AFS::Object::Transaction") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Transaction object");
}
unless ( $transaction->volume() ) {
$self->_Croak("Invalid AFS::Object::Transaction object: has no 'volume' attribute");
lib/AFS/Object/Volume.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Volume;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeHeaders {
my $self = shift;
return unless ref $self->{_headers};
return @{$self->{_headers}};
}
sub _addVolumeHeader {
my $self = shift;
my $header = shift;
unless ( ref $header && $header->isa("AFS::Object::VolumeHeader") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VolumeHeader object");
}
return push( @{$self->{_headers}}, $header );
}
sub getVLDBEntry {
my $self = shift;
return $self->{_vldbentry};
}
sub _addVLDBEntry {
my $self = shift;
my $entry = shift;
unless ( ref $entry && $entry->isa("AFS::Object::VLDBEntry") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBEntry object");
}
return $self->{_vldbentry} = $entry;
}
1;
t/20fs_basic.t view on Meta::CPAN
(
type => 'nfs',
);
if ( ref $result && $result->isa("AFS::Object::CacheManager") ) {
print "ok $TestCounter\n";
$TestCounter++;
if ( defined($result->enabled()) ) {
print "ok $TestCounter\n";
$TestCounter++;
foreach my $attr ( qw(convert uidcheck submounts) ) {
if ( defined($result->$attr()) ) {
print "ok $TestCounter\n";
} else {
print "not ok $TestCounter\n";
warn("No attr '$attr' for fs->exportafs results\n");
}
$TestCounter++;
}
} else {
warn("Unable to determine if translator is enabled or not\n");
util/bin/check_copyright view on Meta::CPAN
if ( $rcs ) {
system("echo 'Updated copyright year' | ci -u $old > /dev/null");
die "Unable to ci -u $old\n" if $? >> 8;
}
}
exit $errors ? 1 : 0;
sub rcs {
my ($file) = @_;
my $dirname = dirname($file);
my $basename = basename($file);
return -f "$dirname/RCS/$basename,v" ? "$dirname/RCS/$basename,v" : "";
}
util/bin/check_version view on Meta::CPAN
if ( $rcs ) {
system("echo 'Updated \$VERSION to $newversion' | ci -u $old > /dev/null");
die "Unable to ci -u $old\n" if $? >> 8;
}
}
exit 0;
sub rcs {
my ($file) = @_;
my $dirname = dirname($file);
my $basename = basename($file);
return -f "$dirname/RCS/$basename,v" ? "$dirname/RCS/$basename,v" : "";
}