#788 use device.name instead of device.dns for pseudo devices

This commit is contained in:
Oliver Gorwits
2021-07-14 12:04:29 +01:00
parent 668bcbe503
commit 0d1dc39d33
5 changed files with 15 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
);
our # try to hide from kwalitee
$VERSION = 64; # schema version used for upgrades, keep as integer
$VERSION = 65; # schema version used for upgrades, keep as integer
use Path::Class;
use File::ShareDir 'dist_dir';

View File

@@ -14,9 +14,9 @@ register_admin_task({
});
sub _sanity_ok {
return 0 unless param('dns')
and param('dns') =~ m/^[[:print:]]+$/
and param('dns') !~ m/[[:space:]]/;
return 0 unless param('name')
and param('name') =~ m/^[[:print:]]+$/
and param('name') !~ m/[[:space:]]/;
my $ip = NetAddr::IP::Lite->new(param('ip'));
return 0 unless ($ip and $ip->addr ne '0.0.0.0');
@@ -34,7 +34,7 @@ ajax '/ajax/control/admin/pseudodevice/add' => require_role admin => sub {
my $device = schema('netdisco')->resultset('Device')
->create({
ip => param('ip'),
dns => param('dns'),
name => param('name'),
vendor => 'netdisco',
layers => param('layers'),
last_discover => \'now()',