Add virtual machine support
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon.pm
index 681a141430953da05c7e2a11db3362522059c61c..1d1ca01f9544c895168dd27e7ed356c3af2cebaf 100644 (file)
@@ -7,8 +7,7 @@ use warnings;
 our $VERSION = '5999.000_004';
 
 use Gruntmaster::Daemon::Constants qw/ERR/;
-use Gruntmaster::Daemon::Format qw/prepare_files/;
-use Gruntmaster::Data;
+use Gruntmaster::Daemon::Format qw/prepare_files stopvms/;
 
 use File::Basename qw/fileparse/;
 use File::Temp qw/tempdir/;
@@ -34,6 +33,8 @@ use constant FORMAT_EXTENSION => {
 
 ##################################################
 
+sub purge;
+
 my $db;
 
 sub safe_can_nodie {
@@ -126,6 +127,7 @@ sub process{
                $meta->{result} = -1;
                $meta->{result_text} = $_;
        };
+       stopvms;
 
        get_logger->info("Job result: " . $meta->{result_text});
        return unless $jobr;
@@ -168,6 +170,8 @@ sub got_job{
 }
 
 sub run{
+       warn "No GRUNTMASTER_VM environment variable. Running without a VM is a security risk.\n"  unless $ENV{GRUNTMASTER_VM};
+       require Gruntmaster::Data;
        $db = Gruntmaster::Data->connect('dbi:Pg:');
        Log::Log4perl->init('/etc/gruntmasterd/gruntmasterd-log.conf');
        get_logger->info("gruntmasterd $VERSION started");
This page took 0.010278 seconds and 4 git commands to generate.