File: //kunden/lib/susshi/exec/stage-delete
#!/usr/bin/perl
use warnings;
use strict;
use lib '/usr/lib/susshi/exec';
use Susshi;
use IPC::Run qw( run timeout );
my $susshi = Susshi->new ( -read_input => 1 );
my $dir = $susshi->get_directory('directory', -mandatory => 1, -must_exist => 1);
# Make sure the directory is writeable (ITOSHL-8155)
chmod(0755, $dir) or error_die "Could not set u+w to $dir: $!";
info "Set chmod 0755 for $dir";
my $cmd=[ 'rm', '-rf', $dir ];
eval {
my $err='';
run $cmd, '2>', \$err or die;
};
error_die "Could not remove $dir: $@" if $@;
info "Deleted stage directory $dir";
exit 0;