#1072 clean custom_fields keys on rediscover

This commit is contained in:
Oliver Gorwits
2023-07-20 12:49:40 +01:00
parent f8222e7890
commit 31489ba550
3 changed files with 14 additions and 8 deletions

View File

@@ -340,14 +340,18 @@ sub jq_insert {
->find($spec->{port}, $spec->{device});
undef $row unless
scalar grep {('cf_'. $_) eq $spec->{action}}
@{ setting('_device_port_custom_fields') || [] };
grep {defined}
map {$_->{name}}
@{ setting('custom_fields')->{device_port} || [] };
}
else {
$row = schema(vars->{'tenant'})->resultset('Device')
->find($spec->{device});
undef $row unless
scalar grep {('cf_'. $_) eq $spec->{action}}
@{ setting('_device_custom_fields') || [] };
grep {defined}
map {$_->{name}}
@{ setting('custom_fields')->{device} || [] };
}
die 'failed to find row for custom field update' unless $row;