diff --git a/.gitignore b/.gitignore index 05fce425..c9f198f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Netdisco/share/environments/* +Netdisco/share/sessions Netdisco/logs/* Netdisco/App-Netdisco-* *.swp diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm index e2410f9f..9a6a8312 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm @@ -25,17 +25,17 @@ sub worker_body { # (will throw an exception) my $job = schema('daemon')->resultset('Admin') ->new_result($candidate); - my $jid = $job->id; + my $jid = $job->job; my $target = 'set_'. $job->action; next unless $self->can($target); - info "int ($wid): can ${target}() for job $jid"; + debug "int ($wid): can ${target}() for job $jid"; # do job my ($status, $log); try { $job->started(scalar localtime); - debug sprintf "int (%s): starting job %s at %s", $wid, $jid, $job->started; + info sprintf "int (%s): starting job %s at %s", $wid, $jid, $job->started; ($status, $log) = $self->$target($job); } catch { @@ -44,7 +44,6 @@ sub worker_body { $self->sendto('stderr', $log ."\n"); }; - info "int ($wid): wrapping up job $jid - status $status"; $self->close_job($job, $status, $log); } @@ -55,6 +54,9 @@ sub worker_body { sub close_job { my ($self, $job, $status, $log) = @_; + my $now = scalar localtime; + info sprintf "int (%s): wrapping up job %s - status %s at %s", + $self->wid, $job->job, $status, $now; try { schema('netdisco')->resultset('Admin') @@ -63,7 +65,7 @@ sub close_job { status => $status, log => $log, started => $job->started, - finished => \'now()', + finished => $now, }); } catch { $self->sendto('stderr', "error closing job: $_\n") }; diff --git a/Netdisco/lib/App/Netdisco/Web.pm b/Netdisco/lib/App/Netdisco/Web.pm index 347ed3dc..06a89d63 100644 --- a/Netdisco/lib/App/Netdisco/Web.pm +++ b/Netdisco/lib/App/Netdisco/Web.pm @@ -15,6 +15,11 @@ use App::Netdisco::Web::Device; use App::Netdisco::Web::TypeAhead; use App::Netdisco::Web::PortControl; +# need to set at runtime the sessions dir in user home +# because YAML config (session_dir) cannot interpolate $ENV{HOME} +use Path::Class 'dir'; +set('session_dir', dir($ENV{HOME}, 'netdisco-web-sessions')); + sub _load_web_plugins { my $plugin_list = shift; diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index 078e1f0b..aa4e61db 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -15,7 +15,7 @@ layout: "main" # about unicode within your app when this setting is set (recommended). charset: "UTF-8" -# web sessions stored in memory +# web sessions stored on disk session: "YAML" # logging format