App-ClusterSSH
view release on metacpan or search on metacpan
bin_PL/_build_docs view on Meta::CPAN
for my $dest (@ARGV) {
my $source=$Bin.'/'.basename($dest);
next if($source =~ m/$Script/);
next if($source =~ m/\.x$/);
print "Generating: $source",$/;
if(-f $dest) {
chmod(0777, $dest) || die "Could not chmod $dest for removing: $!";
}
open(my $sfh, '<', $source) || die "Could not open $source for reading: $!";
open(my $dfh, '>', $dest ) || die "Could not open $dest for writing: $!";
print $dfh $_ while(<$sfh>);
close($sfh);
if($source !~ m/clusterssh_bash_completion.dist/) {
print $dfh "\n\n__END__\n\n";
my $pod= qx{ $^X $source --generate-pod };
die "Failed to generate pod" if($?);
print $dfh $pod;
}
close($dfh);
chmod(0555, $dest) || die "Could not chmod $dest: $!";
}
t/15config.t view on Meta::CPAN
SKIP: {
skip "Test inappropriate when running as root", 5 if $< == 0;
note('move of .csshrc failure');
$ENV{HOME} = tempdir( CLEANUP => 1 );
open( $csshrc, '>', $ENV{HOME} . '/.csshrc' );
print $csshrc "Something", $/;
close($csshrc);
open( $csshrc, '>', $ENV{HOME} . '/.csshrc.DISABLED' );
print $csshrc "Something else", $/;
close($csshrc);
chmod( 0666, $ENV{HOME} . '/.csshrc.DISABLED', $ENV{HOME} );
$config = App::ClusterSSH::Config->new();
trap {
$config->write_user_config_file();
};
is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->stdout, q{}, 'Expecting no STDOUT' );
is( $trap->stderr, q{}, 'Expecting no STDERR' );
is( $trap->die,
q{Unable to create directory $HOME/.clusterssh: Permission denied}
. $/,
'Expected die msg ' . $trap->stderr
);
chmod( 0755, $ENV{HOME} . '/.csshrc.DISABLED', $ENV{HOME} );
}
note('check failure to write default config is caught');
$ENV{HOME} = tempdir( CLEANUP => 1 );
mkdir( $ENV{HOME} . '/.clusterssh' );
mkdir( $ENV{HOME} . '/.clusterssh/config' );
$config = App::ClusterSSH::Config->new();
trap {
$config->load_configs();
};
t/30cluster.t view on Meta::CPAN
trap {
$cluster1->read_cluster_file( $Bin . '/30cluster.doesnt exist' );
};
is( !$trap, '', 'coped with missing file ok' );
isa_ok( $cluster1, 'App::ClusterSSH::Cluster' );
# no point running this test as root since root cannot be blocked
# from accessing the file
if ( $EUID != 0 ) {
my $no_read = $Bin . '/30cluster.cannot_read';
chmod 0000, $no_read;
trap {
$cluster1->read_cluster_file($no_read);
};
chmod 0644, $no_read;
isa_ok( $trap->die, 'App::ClusterSSH::Exception::LoadFile' );
is( $trap->die,
"Unable to read file $no_read: Permission denied",
'Error on reading an existing file ok'
);
}
else {
pass('Cannot test for lack of read access when run as root');
}
( run in 0.298 second using v1.01-cache-2.11-cpan-496ff517765 )