aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKnut Auvor Grythe <knut@auvor.no>2015-04-01 01:23:24 +0200
committerroot <root@einstein.tg15.gathering.org>2015-04-01 01:23:24 +0200
commit250444f4ca039de57bba64edbfd9cd73d5920a59 (patch)
treec115f8f715fdc94d1afaf9e36f07d96b7e507c98
parent8ce0c22a42189aa9411d26d1c5a320da919e1286 (diff)
replace json with regex to add support for JunOS 12.3R6.6
-rwxr-xr-xclients/smanagrun.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/clients/smanagrun.pl b/clients/smanagrun.pl
index 52f627e..9e3c850 100755
--- a/clients/smanagrun.pl
+++ b/clients/smanagrun.pl
@@ -118,9 +118,15 @@ while (1) {
$cmd =~ s/%SYSNAME%/$sysname/g;
if ($cmd =~ /^#\s*require-version\s+(.*\S)\s*$/) {
my $required_version = $1;
- my $versions;
- $versions = switch_exec_json("show version", $conn);
- my $version = $versions->{'multi-routing-engine-results'}[0]{'multi-routing-engine-item'}[0]{'software-information'}[0]{'junos-version'}[0]{'data'};
+ my $version;
+ foreach my $line (switch_exec("show version", $conn)) {
+ if ($line =~ /^JUNOS Base OS boot \[(.*)\]/) {
+ $version = $1;
+ } elsif ($line =~ /^Junos: (.*\S)/) {
+ $version = $1;
+ }
+ last if defined $version;
+ }
if ($version ne $required_version) {
push @data, "# '$version' != '$required_version', aborting script";
last;