change from settings to vars for tracking param defaults

This commit is contained in:
Oliver Gorwits
2017-12-11 23:51:01 +00:00
parent f6c985bd60
commit 45a0a75d96
11 changed files with 84 additions and 86 deletions

View File

@@ -6,6 +6,7 @@ use Dancer::Plugin;
use App::Netdisco::Util::Permission qw/check_acl_no check_acl_only/;
use aliased 'App::Netdisco::Worker::Status';
use Scope::Guard 'guard';
use Storable 'dclone';
register 'register_worker' => sub {
my ($self, $first, $second) = plugin_args(@_);
@@ -47,7 +48,7 @@ register 'register_worker' => sub {
}
my @newuserconf = ();
my @userconf = @{ setting('device_auth') || [] };
my @userconf = @{ dclone (setting('device_auth') || []) };
# worker might be vendor/platform specific
if (ref $job->device) {
@@ -67,7 +68,7 @@ register 'register_worker' => sub {
next if exists $stanza->{action}
and not _find_matchaction($workerconf, lc($stanza->{action}));
push @newuserconf, $stanza;
push @newuserconf, dclone $stanza;
}
# per-device action but no device creds available

View File

@@ -8,6 +8,7 @@ use aliased 'App::Netdisco::Worker::Status';
use Try::Tiny;
use Module::Load ();
use Scope::Guard 'guard';
use Storable 'dclone';
use Moo::Role;
use namespace::clean;
@@ -31,7 +32,7 @@ sub run {
my $statusguard = guard { $job->finalise_status };
my @newuserconf = ();
my @userconf = @{ setting('device_auth') || [] };
my @userconf = @{ dclone (setting('device_auth') || []) };
# reduce device_auth by only/no
if (ref $job->device) {
@@ -42,7 +43,7 @@ sub run {
next if $no and check_acl_no($job->device, $no);
next if $only and not check_acl_only($job->device, $only);
push @newuserconf, $stanza;
push @newuserconf, dclone $stanza;
}
# per-device action but no device creds available