beakerlib-infrastructure

Langue: en

Version: 2010-05-12 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

BeakerLib - infrastructure - mounting, backup and service helpers

DESCRIPTION

BeakerLib functions providing checking and mounting NFS shares, backing up and restoring files and controlling running services.

FUNCTIONS

Mounting

rlMount

Create mount point (if neccessary) and mount a NFS share.

     rlMount server share mountpoint
 
 
server
NFS server hostname.
share
Shared directory name.
mountpoint
Local mount point.

Returns 0 if mounting the share was successful.

rlCheckMount

Check whether a share is mounted.

     rlCheckMount server share mountpoint
 
 
server
NFS server hostname.
share
Shared directory name.
mountpoint
Local mount point.

Returns 0 when specified mount point exists and NFS share is mounted.

rlAssertMount

Assertion making sure that given NFS share is mounted.

     rlAssertMount server share mountpoint
 
 
server
NFS server hostname.
share
Shared directory name.
mountpoint
Local mount point.

Returns 0 and asserts PASS when specified mount point exists and NFS share is mounted.

Backup and Restore

rlFileBackup

Create a backup of files or directories (recursive). Can be used multiple times to add more files to backup. Backing up an already backed up file overwrites the original backup.

     rlFileBackup [--clean] file [file...]
 
 
--clean
If this option is provided (have to be first option of the command), then file/dir backuped using this command (provided in next options) will be (resursively) removed before we will restore it.
file
Files and/or directories to be backed up.

Returns 0 if the backup was successful.

Example with --clean:

     touch cleandir/aaa
     rlFileBackup --clean cleandir/
     touch cleandir/bbb
     ls cleandir/
     aaa   bbb
     rlFileRestore
     ls cleandir/
     aaa
 
 

rlFileRestore

Restore backed up files to their original location. "rlFileRestore" does not remove new files appearing after backup has been made. If you don't want to leave anything behind just remove the whole original tree before running "rlFileRestore", or see "--clean" option of "rlFileBackup".

     rlFileRestore
 
 

Returns 0 if backup dir is found and files are restored successfully.

Services

Following routines implement comfortable way how to start/stop system services with the possibility to restore them to their original state after testing.

rlServiceStart

Make sure the given "service" is running with fresh configuration. (Start it if it's stopped and restart if it is already running.) In addition, when called for the first time, the current state is saved so that the "service" can be restored to its original state when testing is finished, see "rlServiceRestore".

     rlServiceStart service [service...]
 
 
service
Name of the service(s) to start.

Returns number of services which failed to start/restart; thus zero is returned when everything is OK.

rlServiceStop

Make sure the given "service" is stopped. Stop it if it is running and do nothing when it is already stopped. In addition, when called for the first time, the current state is saved so that the "service" can be restored to its original state when testing is finished, see "rlServiceRestore".

     rlServiceStop service [service...]
 
 
service
Name of the service(s) to stop.

Returns number of services which failed to become stopped; thus zero is returned when everything is OK.

rlServiceRestore

Restore given "service" into its original state (before the first "rlServiceStart" or "rlServiceStop" was called).

     rlServiceRestore service [service...]
 
 
service
Name of the service(s) to restore to original state.

Returns number of services which failed to get back to their original state; thus zero is returned when everything is OK.

AUTHORS

*
Petr Muller <pmuller@redhat.com>
*
Jan Hutar <jhutar@redhat.com>
*
Petr Splichal <psplicha@redhat.com>
*
Ales Zelinka <azelinka@redhat.com>