From 4ae9b329737d655a13dbba3ad1b7855baac17437 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Tue, 21 Apr 2020 00:43:59 +0200 Subject: [PATCH] Fix #704, allow delete without device_auth * This typically comes up when using a deployment.yml generated from some inventory source, the device disappears and can then no longer be deleted since netdisco-delete unnecessarily insists on needing a valid device_auth --- lib/App/Netdisco/Worker/Plugin.pm | 2 +- lib/App/Netdisco/Worker/Runner.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin.pm b/lib/App/Netdisco/Worker/Plugin.pm index 8f05a7c4..6eca1d72 100644 --- a/lib/App/Netdisco/Worker/Plugin.pm +++ b/lib/App/Netdisco/Worker/Plugin.pm @@ -76,7 +76,7 @@ register 'register_worker' => sub { # per-device action but no device creds available return $job->add_status( Status->info('skip: driver or action not applicable') ) - if 0 == scalar @newuserconf; + if 0 == scalar @newuserconf && $job->action ne "delete"; } # back up and restore device_auth diff --git a/lib/App/Netdisco/Worker/Runner.pm b/lib/App/Netdisco/Worker/Runner.pm index 2c5e21ef..d7f67f6c 100644 --- a/lib/App/Netdisco/Worker/Runner.pm +++ b/lib/App/Netdisco/Worker/Runner.pm @@ -51,7 +51,7 @@ sub run { # per-device action but no device creds available return $job->add_status( Status->defer('deferred job with no device creds') ) - if 0 == scalar @newuserconf; + if 0 == scalar @newuserconf && $job->action ne "delete"; } # back up and restore device_auth