topology import script runs discover for each device (M. Bauer)

This commit is contained in:
Oliver Gorwits
2017-05-17 07:37:05 +01:00
parent da04522199
commit 8e07636a14
2 changed files with 10 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
[ENHANCEMENTTS]
* renamed netdisco-daemon to netdisco-backend (and *-fg too)
* topology import script runs discover for each device (M. Bauer)
[BUG FIXES]

View File

@@ -37,7 +37,9 @@ use App::Netdisco;
use Dancer ':script';
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::JobQueue 'jq_insert';
use App::Netdisco::Util::Device 'get_device';
use NetAddr::IP::Lite ':lower';
use Try::Tiny;
@@ -63,7 +65,8 @@ The file syntax must be like so:
link:left-port,right-device,right-port
The devices can be either host names or IPs. Data will be imported even if the
devices are currently unknown to Netdisco.
devices are currently unknown to Netdisco. All imported devices will have a
C<discover> job queued for them.
=cut
@@ -115,6 +118,11 @@ while (my $line = <DEVS>) {
$dev = get_device($ip->addr)->ip;
print " Set device: $dev\n";
jq_insert({
action => 'discover',
device => $dev,
});
}
}