AFS-Command

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

	of the Copyright Holder as specified below.

	"Copyright Holder" is whoever is named in the copyright or
	copyrights for the package.

	"You" is you, if you're thinking about copying or distributing
	this Package.

	"Reasonable copying fee" is whatever you can justify on the
	basis of media cost, duplication charges, time of people
	involved, and so on.  (You will not be required to justify it
	to the Copyright Holder, but only to the computing community
	at large as a market that must bear the fee.)

	"Freely Available" means that no fee is charged for the item
	itself, though there may be fees involved in handling the
	item.  It also means that recipients of the item may
	redistribute it under the same conditions they received it.

1. You may make and give away verbatim copies of the source form of
   the Standard Version of this Package without restriction, provided

lib/AFS/Command/BOS.pod  view on Meta::CPAN

       rxdebug			=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 setauth

The bos help string is:

    bos setauth: set authentication required flag
    Usage: bos setauth -server <machine name>
		       -authrequired <on or off: authentication required for admin requests>
		       [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->setauth
      (
       # Required arguments
       server			=> $server,
       authrequired		=> $authrequired,
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 setcellname

The bos help string is:

lib/AFS/Command/Base.pm  view on Meta::CPAN

}

sub _arguments {

    my $self		= shift;
    my $operation 	= shift;

    my $arguments =
      {
       optional		=> {},
       required		=> {},
       aliases		=> {},
      };

    my @command;
    push (@command, @{$self->{command}});

    unless ( $self->_operations($operation) ) {
	$self->_Carp("Unsupported @command operation '$operation'\n");
	return;
    }

lib/AFS/Command/Base.pm  view on Meta::CPAN


	    while ( $_ ) {
		if ( s/^\[\s*-(\w+?)\s*\]\s*//  ) {
		    $arguments->{optional}->{$1} = 0
		      unless $1 eq 'help'; # Yeah, skip it...
		} elsif ( s/^\[\s*-(\w+?)\s+<[^>]*?>\+\s*]\s*// ) {
		    $arguments->{optional}->{$1} = [];
		} elsif ( s/^\[\s*-(\w+?)\s+<[^>]*?>\s*]\s*// ) {
		    $arguments->{optional}->{$1} = 1;
		} elsif ( s/^\s*-(\w+?)\s+<[^>]*?>\+\s*// ) {
		    $arguments->{required}->{$1} = [];
		} elsif ( s/^\s*-(\w+?)\s+<[^>]*?>\s*// ) {
		    $arguments->{required}->{$1} = 1;
		} elsif ( s/^\s*-(\w+?)\s*// ) {
		    $arguments->{required}->{$1} = 0;
		} else {
		    $self->_Carp("Unable to parse @command help for $operation\n" .
				 "Unrecognized string: '$_'");
		    $errors++;
		    last;
		}
	    }

	    last;

lib/AFS/Command/Base.pm  view on Meta::CPAN


	my @argv = ( @{$self->{command}}, $self->{operation} );

	foreach my $key ( keys %args ) {
	    next unless $arguments->{aliases}->{$key};
	    $args{$arguments->{aliases}->{$key}} = delete $args{$key};
	}

	foreach my $key ( qw( noauth localauth encrypt ) ) {
	    next unless $self->{$key};
	    $args{$key}++ if exists $arguments->{required}->{$key};
	    $args{$key}++ if exists $arguments->{optional}->{$key};
	}

	unless ( $self->{quiet} ) {
	    $args{verbose}++ if exists $arguments->{optional}->{verbose};
	}

	foreach my $type ( qw( required optional ) ) {

	    foreach my $key ( keys %{$arguments->{$type}} ) {

		my $hasvalue = $arguments->{$type}->{$key};

		if ( $type eq 'required' ) {
		    unless ( exists $args{$key} ) {
			$self->_Carp("Required argument '$key' not provided");
			return;
		    }
		} else {
		    next unless exists $args{$key};
		}

		if ( $hasvalue ) {
		    if ( ref $args{$key} eq 'HASH' || ref $args{$key} eq 'ARRAY' ) {

lib/AFS/Command/Base.pod  view on Meta::CPAN

=item timestamps

If this argument is given, then the output collected from the commands
will be prepended with the date formatted using Date::Format with:

    %Y/%m/%d %H:%M:%S

This is primarily useful for debugging and timing of commands such as
vos release, which can be very time consuming.  Since we enable
-verbose by default, this option will let us determine the relative
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

lib/AFS/Command/FS.pm  view on Meta::CPAN


    while ( defined($_ = $self->{handle}->getline()) ) {

	next if /^Volume Name/;

	my $path = AFS::Object::Path->new();

	if ( /fs: Invalid argument; it is possible that (.*) is not in AFS./ ||
	     /fs: no such cell as \'(.*)\'/ ||
	     /fs: File \'(.*)\' doesn\'t exist/ ||
	     /fs: You don\'t have the required access rights on \'(.*)\'/ ) {

	    $path->_setAttribute
	      (
	       path 		=> $1,
	       error		=> $_,
	      );

	    delete $paths{$1};
	    @paths = grep($_ ne $1,@paths);

lib/AFS/Command/VOS.pm  view on Meta::CPAN

}

sub dump {

    my $self = shift;
    my (%args) = @_;

    $self->{operation} = 'dump';

    my $file = delete $args{file} || do {
	$self->_Carp("Missing required argument: 'file'");
	return;
    };

    my $gzip_default = 6;
    my $bzip2_default = 6;

    my $nocompress = delete $args{nocompress} || undef;
    my $gzip = delete $args{gzip} || undef;
    my $bzip2 = delete $args{bzip2} || undef;
    my $filterout = delete $args{filterout} || undef;

lib/AFS/Command/VOS.pm  view on Meta::CPAN

}

sub restore {

    my $self = shift;
    my (%args) = @_;

    $self->{operation} = "restore";

    my $file = delete $args{file} || do {
	$self->_Carp("Missing required argument: 'file'");
	return;
    };

    my $nocompress = delete $args{nocompress} || undef;
    my $gunzip = delete $args{gunzip} || undef;
    my $bunzip2 = delete $args{bunzip2} || undef;
    my $filterin = delete $args{filterin} || undef;;

    if ( $gunzip && $bunzip2 && $nocompress ) {
	$self->_Carp("Invalid argument combination: only one of 'gunzip' or 'bunzip2' or 'nocompress' may be specified");

lib/AFS/Command/VOS.pod  view on Meta::CPAN

       localauth                => 1,
       verbose                  => 1,
       encrypt                  => 1,
       # Enhanced arguments
       gzip			=> $gzip,
       bzip2			=> $bzip2,
       filterout		=> [ @command ], # OR [ [ @cmd1 ], [ @cmd2 ], ... ]
      );

The first thing to notice is that 'file' is optional to the vos dump
command itself, but required in this API.  The second thing to notice
is the addition of three new arguments: gzip, bzip2 and filterout.

=over

=item file

This argument specifies the file to which the vos dump output should
be written.  If this file ends in '.gz' or '.bz2', then gzip or bzip2
will be used to compress the output before it is written to the
filesystem.  This is accomplished using a pipe, so there is no

lib/AFS/Command/VOS.pod  view on Meta::CPAN

=back

Note that the default behavior creates the condition where the
Creation time is newer than the LastUpdate time, and when this is
true, "vos examine" (or any command that display the timestamps in the
volume header, really) will show the Creation time as the LastUpdate
time, presumably because it would be confusing to show the volume as
having been updated before it was created.

Similar to 'vos dump', the 'file' argument is optional to 'vos
restore', but required in this API.  There are also three new
arguments: gunzip, bunzip2, and filterin.  The analogy with 'vos dump'
is by design entirely symmetrical.

=over

=item file

This argument specifies the file from which the vos restore input
should be read.  If the file ends in '.gz' or '.bz2', then gunzip or
bunzip2 will be used to uncompress the input before it is read by vos



( run in 0.622 second using v1.01-cache-2.11-cpan-0a6323c29d9 )