delete hook (#1032)
* make log_message optional in delete_device * add hooks support to delete job * make delete job high prio * web delete now queues job instead of inline delete * move web logging into web package and remove userlog from device delete helper * submit delete job for expire device instead of inline delete * fixes to get web submit form for delete device to work * enable delete hook functionality
This commit is contained in:
@@ -77,7 +77,7 @@ Returns true if the transaction completes, else returns false.
|
||||
=cut
|
||||
|
||||
sub delete_device {
|
||||
my ($ip, $archive, $log) = @_;
|
||||
my ($ip, $archive) = @_;
|
||||
my $device = get_device($ip) or return 0;
|
||||
return 0 if not $device->in_storage;
|
||||
|
||||
@@ -87,13 +87,6 @@ sub delete_device {
|
||||
schema(vars->{'tenant'})->resultset('Device')
|
||||
->search({ ip => $device->ip })->delete({archive_nodes => $archive});
|
||||
|
||||
schema(vars->{'tenant'})->resultset('UserLog')->create({
|
||||
username => session('logged_in_user'),
|
||||
userip => scalar eval {request->remote_address},
|
||||
event => (sprintf "Delete device %s", $device->ip),
|
||||
details => $log,
|
||||
});
|
||||
|
||||
$happy = 1;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user