Commit 001f3129 authored by Steven Murray's avatar Steven Murray
Browse files

Stage id and group now obtained using 'id stage'. There is no longer a need to

configure this.
parent b6a74ed1
......@@ -40,6 +40,8 @@ our $VERSION = 1.00;
our @ISA = qw(Exporter);
our @export = qw(
get_uid_for_username
get_gid_for_username
get_disk_servers
read_config
check_environment
......@@ -73,6 +75,7 @@ our @export = qw(
check_leftovers_poll_timeout
nullize_arrays_undefs
print_leftovers
reinstall_stager_db
getOrastagerconfigParam
cleanup
elapsed_time
......@@ -91,6 +94,39 @@ my %environment = (
my $time_reference;
# Returns the numeric user ID of the user with given name
sub get_uid_for_username( $ )
{
my $username = shift;
my $id_result=`id $username`;
chomp($id_result);
if($id_result =~ m/uid=(\d+)/) {
return $1;
} else {
die("Failed to get uid for username \"$username\"\n");
}
}
# Returns the numeric group ID of the user with given name
sub get_gid_for_username( $ )
{
my $username = shift;
my $id_result=`id $username`;
chomp($id_result);
if($id_result =~ m/gid=(\d+)/) {
return $1;
} else {
die("Failed to get uid for username \"$username\"\n");
}
}
# Based on the output of bhosts, this subroutine returns the hostnames of the
# disk-servers sorted alphabetically.
sub get_disk_servers()
......@@ -122,8 +158,8 @@ sub read_config ( $ )
$environment{hostname} = $local_host;
my @per_host_vars = ( 'username', 'checkout_location', 'file_size', 'file_number', 'castor_directory',
'migration_timeout', 'poll_interval', 'tapepool');
my @global_vars = ( 'dbDir' , 'tstDir', 'stageUid', 'stageGid', 'adminList',
'originalDbSchema', 'originalDropSchema', 'castor_single_subdirectory',
my @global_vars = ( 'dbDir' , 'tstDir', 'adminList', 'originalDbSchema',
'originalDropSchema', 'castor_single_subdirectory',
'castor_dual_subdirectory' );
for my $i ( @per_host_vars ) {
$environment{$i}=getConfParam('TAPETEST', $i.'_'.$local_host, $config_file );
......@@ -1272,8 +1308,8 @@ sub reinstall_stager_db()
$originalDropSchemaFullpath,
"Dropping schema");
my $stageGid = $environment{stageGid};
my $stageUid = $environment{stageUid};
my $stageUid = &get_uid_for_username('stage');
my $stageGid = &get_gid_for_username('stage');
my $adminList = $environment{adminList};
my $hacked_creation= `mktemp`;
......
......@@ -23,8 +23,6 @@ TAPETEST tapepool_lxcastordev04 stager_dev04
# General parameters
TAPETEST dbDir castor/db
TAPETEST tstDir test/tapegateway_release_tests
TAPETEST stageUid 14029
TAPETEST stageGid 1474
TAPETEST adminList :1028
TAPETEST originalDbSchema stager_oracle_create.sql
TAPETEST originalDropSchema drop_oracle_schema.sql
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment