App-Netdisco

 view release on metacpan or  search on metacpan

bin/netdisco-do  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;

our $home;

BEGIN {
  use FindBin;
  FindBin::again();

  $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});

  # try to find a localenv if one isn't already in place.
  if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
      use File::Spec;
      my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;
      $localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;

      die "Sorry, can't find libs required for App::Netdisco.\n"
        if !exists $ENV{PERLBREW_PERL};
  }
}

BEGIN {
  use Path::Class;

  # stuff useful locations into @INC and $PATH
  unshift @INC,
    dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
    dir($FindBin::RealBin, 'lib')->stringify;
}

# for netdisco app config
use App::Netdisco;
use Dancer qw/:moose :script/;

use Try::Tiny;
use Pod::Usage;
use Scalar::Util 'blessed';
use File::Slurper 'read_lines';
use NetAddr::IP qw/:rfc3021 :lower/;

use App::Netdisco::Backend::Job;
use App::Netdisco::JobQueue 'jq_insert';
use App::Netdisco::Util::Device 'get_device';

use Getopt::Long;
Getopt::Long::Configure ("bundling");

my ($port, $extra, $debug, $quiet, $queue_only, $force, $dryrun, $rollback);
my ($devices, $infotrace, $snmptrace, $sqltrace) = ([], 0, 0, 0);

my $result = GetOptions(
  'device|d=s@' => \$devices,
  'port|p=s'   => \$port,
  'extra|e=s'  => \$extra,
  'debug|D'    => \$debug,
  'enqueue'    => \$queue_only,
  'force'      => \$force,
  'dry-run'    => \$dryrun,
  'quiet'      => \$quiet,
  'rollback|R' => \$rollback,
  'infotrace|I+' => \$infotrace,
  'snmptrace|S+' => \$snmptrace,
  'sqltrace|Q+'  => \$sqltrace,
) or pod2usage(
  -msg => 'error: bad options',
  -verbose => 0,
  -exitval => 1,
);

if ($dryrun) {
  $ENV{ND2_WORKER_ROLL_CALL} = 1;
  $debug = 1;
}

my $CONFIG = config();

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.679 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )