Give Pseudo Devices better OS, OS ver, Port Descr, Discovered, and DNS Name
* started pseudodevice rework * give them a type, os, os_ver and num_ports * os_ver will be the netdisco version in which they were created * give their ports the same value for device_port.descr as device_port.port * add db update to fill out those fields if they are null, which is most likely * update last_discover if you make changes to the device * num_ports will not be updates by the db script, neither will device_port.descr * use device.name, not device.dns for pseudo * at least try and get reverse dns for pseudo, works if there is one * add db revision to manifest * take dns no config into account * new meta * new version Co-authored-by: Oliver Gorwits <ollyg@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use Time::Piece; # for OO localtime
|
||||
|
||||
use base 'Exporter';
|
||||
our @EXPORT = ();
|
||||
our @EXPORT_OK = qw/update_stats/;
|
||||
our @EXPORT_OK = qw/pretty_version update_stats/;
|
||||
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
||||
|
||||
=head1 NAME
|
||||
@@ -78,10 +78,23 @@ sub update_stats {
|
||||
});
|
||||
}
|
||||
|
||||
# take perl or pg versions and make pretty
|
||||
=head2 pretty_version ( $versionstring , $seglen )
|
||||
|
||||
Splits a string (only numbers and dots allowed) into a number of parts which
|
||||
are seglen long, then removes all leading zeros from each part and returns
|
||||
the parts joined by dots as one string.
|
||||
|
||||
Returns the original versionstring if unallowed characters are found or seglen
|
||||
is negative.
|
||||
|
||||
Returns C<undef> if seglen is zero.
|
||||
|
||||
=cut
|
||||
|
||||
sub pretty_version {
|
||||
my ($version, $seglen) = @_;
|
||||
return unless $version and $seglen;
|
||||
return $version unless $seglen > 0;
|
||||
return $version if $version !~ m/^[0-9.]+$/;
|
||||
$version =~ s/\.//g;
|
||||
$version = (join '.', reverse map {scalar reverse}
|
||||
|
||||
Reference in New Issue
Block a user