AFS-Command

 view release on metacpan or  search on metacpan

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

#
# $Id: BOS.pod,v 7.1 2004/01/13 19:01:12 wpm Exp $
#
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#

=head1 NAME

AFS::Command::BOS - OO API to the AFS bos command

=head1 SYNOPSIS

    use AFS::Command::BOS;

    my $bos = AFS::Command::BOS->new();

    my $bos = AFS::Command::BOS->new
      (
       command			=> $path_to_your_bos_binary,
      );

    my $bos = AFS::Command::BOS->new
      (
       localauth		=> 1,
      );

=head1 DESCRIPTION

This module implements an OO API wrapper around the AFS 'bos' command.
The supported methods depend on the version of the bos binary used,
and are determined automagically.

=head1 METHODS -- Inherited

All of the following methods are inherited from the AFS::Command::Base
class.  See that documentation for details.

=over

=item new

=item errors

=item supportsOperation

=item supportsArgument

=back

=head1 METHODS (with complex return values)

=head2 getdate

=over

=item Arguments

The bos help string is:

    bos getdate: get dates for programs
    Usage: bos getdate -server <machine name> -file <files to check>+ [-dir <destination dir>]
		       [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->getdate
      (
       # Required arguments
       server			=> $server,
       file			=> $file, # OR [ $file1, $file2, ... ]
       # Optional arguments
       dir			=> $dir,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=item Return Values

This method returns an AFS::Object::BosServer object, which
contains one or more generic AFS::Object, one for each file
specified in the arguments.

    my $result = $bos->getdate
      (
       file				=> [ 'bosserver', 'vlserver', 'ptserver' ],
       cell				=> $cell,
      ) || die $bos->errors();

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

      ) || die $bos->errors();
    my $users = $result->susers();
    print "Server $server in cell $cell has users:\n"
    foreach my $user ( @$users ) {
        print "\t$user\n";
    }

The object has the following attribute:

B<AFS::Object::BosServer>

    Attributes			Values
    ----------			------
    susers			ARRAY reference of super user names

=back

=head2 status

=over

=item Arguments

The bos help string is:

    bos status: show server instance status
    Usage: bos status -server <machine name> [-instance <server process name>+]
		      [-long] [-cell <cell name>] [-noauth] [-localauth]
    Where: -long       long status

The corresponding method invocation looks like:

    my $result = $bos->status
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       instance			=> $instance, # OR [ $inst1, $inst2, ... ],
       cell			=> $cell,
       long			=> 1,
       noauth			=> 1,
       localauth		=> 1,
      );

=item Return Values

This method returns an AFS::Object::BosServer object, which
contains one optional attribute, and one or more
AFS::Object::Instance objects, each of which represents a
single instance of a bosserver managed process on the server.

    my $result = $bos->status
      (
       server			=> $server,
       long				=> 1,
      ) || die $bos->errors();
    foreach my $instanceobj ( $result->getInstances() ) {
	my $instance		= $instanceobj->instance();
	my $status			= $instanceobj->status();
	print "Instance $instance has status $status\n";
	foreach my $commandobj ( $instance->getCommands() ) {
	    my $index		= $commandobj->index();
	    my $command		= $commandobj->command();
	    print "\tCmd $index is '$command'\n";
	}
    }

The objects have the following attributes and methods:

B<AFS::Object::BosServer>

The following attribute is only present when "bos status" reports
inappropriate access on directories:

    Attributes			Values
    ----------			------
    access			Boolean, true indicating a potential security problem

The following methods can be used to extract the instance objects:

    Methods			Returns
    -------			-------
    getInstanceNames()		list of instance names
    getInstances()		list of AFS::Object::Instance objects
    getInstance($name)		one AFS::Object::Instance object for the instance $name

B<AFS::Object::Instance>

The following attributes are always present:

    Attributes			Values
    ----------			------
    instance			Name of the instance
    status			Status string (running normally, shutdown, etc.)

The following attribute is always present is the instance is of type
'cron':

    Attributes			Values
    ----------			------
    auxiliary			Auxiliary status (date the next execution)

The following attributes are always available when the 'long' argument
is specified:

    Attributes			Values
    ----------			------
    type			"cron", "simple", or "fs"
    startdate			Date when the process was last started
    startcount			Number of times the process has started,
				since the bosserver was started
    exitdate			Date when the process last exited

The following attributes are optionally available, depending on the
state of the instance, when the 'long' argument is specified:

    Attributes			Values
    ----------			------
    notifier			Path to the notifier application for this instance
    state			"temporarily disabled", or "disabled", or "temporarily enabled"
    errorstop			Boolean, indicating the process was
				"stopped for too many errors"
    core			Boolean, indicating the instance has a core file
    errorexitdate		Date when the process last exited with an error
    errorexitdue		"shutdown", or "signal", or "code" (present only when
				"errorexitdate" attribute is present)
    errorexitsignal		Signal that cause the error exit (present only when
				"errorexitdue" eq "signal")
    errorexitcode		Exit code from last error exit (present only when
				"errorexitdue" eq "code")

The following methods can be used to extract the command objects,
which are also only present when the 'long' argument is specified.

    Methods			Returns
    -------			-------
    getCommandIndexes()		list of numeric indexes for the commands
    getCommands()		list of AFS::Object objects for all commands
    getCommand($index)		the AFS::Object object for the command with index $index

B<AFS::Object> (Commands)

The following pair of attributes are always present:

    Attributes			Values
    ----------			------
    index			Numerical index of the command
    command			Command string

=back

=head1 METHODS (with simple return values)

All of the following commands return a simple Boolean (true/false)
value, if they succeed or fail.

=head2 addhost

The bos help string is:

    bos addhost: add host to cell dbase
    Usage: bos addhost -server <machine name> -host <host name>+
		       [-clone] [-cell <cell name>] [-noauth] [-localauth]
    Where: -clone      vote doesn't count

The corresponding method invocation looks like:

    my $result = $bos->addhost
      (
       # Required arguments
       server			=> $server,
       host			=> $host, # OR [ $host1, $host2, ... ]
       # Optional arguments
       clone			=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 addkey

The bos help string is:

    bos addkey: add keys to key dbase (kvno 999 is bcrypt)
    Usage: bos addkey -server <machine name> [-key <key>] -kvno <key version number>
		      [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

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

=head2 adduser

The bos help string is:

    bos adduser: add users to super-user list
    Usage: bos adduser -server <machine name> -user <user names>+
		       [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->adduser
      (
       # Required arguments
       server			=> $server,
       user			=> $user, # OR [ $user1, $user2, ... ]
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 blockscanner

The bos help string is:

    bos blockscanner: block scanner daemon from making migration requests
    Usage: bos blockscanner -server <machine name> [-cell <cell name>]
			    [-noauth] [-localauth]

The corresponding method invocation looks like:

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

=head2 create

The bos help string is:

    bos create: create a new server instance
    Usage: bos create -server <machine name> -instance <server process name>
		      -type <server type> -cmd <command lines>+ [-notifier <Notifier program>]
		      [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->create
      (
       # Required arguments
       server			=> $server,
       instance			=> $instance,
       type			=> $type,
       cmd			=> $cmd, # OR [ $cmd1, $cmd2, ... ]
       # Optional arguments
       notifier			=> $notifier,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 delete

The bos help string is:

    bos delete: delete a server instance
    Usage: bos delete -server <machine name> -instance <server process name>+
		      [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->delete
      (
       # Required arguments
       server			=> $server,
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 exec

The bos help string is:

    bos exec: execute shell command on server
    Usage: bos exec -server <machine name> -cmd <command to execute>
		    [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

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

=head2 install

The bos help string is:

    bos install: install program
    Usage: bos install -server <machine name> -file <files to install>+
		       [-dir <destination dir>] [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->install
      (
       # Required arguments
       server			=> $server,
       file			=> $file, # OR [ $file1, $file2, ... ]
       # Optional arguments
       dir			=> $dir,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 prune

The bos help string is:

    bos prune: prune server files
    Usage: bos prune -server <machine name> [-bak] [-old] [-core] [-all]
		     [-cell <cell name>] [-noauth] [-localauth]
    Where: -bak        delete .BAK files
	   -old        delete .OLD files
	   -core       delete core files
	   -all        delete all junk files

The corresponding method invocation looks like:

    my $result = $bos->prune
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       bak			=> 1,
       old			=> 1,
       core			=> 1,
       all			=> 1,



( run in 1.053 second using v1.01-cache-2.11-cpan-d8267643d1d )