diff options
author | Robert Bays <rbays@roatan.(none)> | 2010-05-23 00:26:04 -0700 |
---|---|---|
committer | Robert Bays <rbays@roatan.(none)> | 2010-05-23 00:26:04 -0700 |
commit | 8a6a7bd1ca4f4607bbacc3f135665f7d4e5894d5 (patch) | |
tree | 3fe79fbd21505887b301a04d706bec1f637552f9 /lib | |
parent | 9b35460dbd426d8439ae00138b06de0235697294 (diff) | |
download | vyatta-cfg-quagga-8a6a7bd1ca4f4607bbacc3f135665f7d4e5894d5.tar.gz vyatta-cfg-quagga-8a6a7bd1ca4f4607bbacc3f135665f7d4e5894d5.zip |
change the system call in _sendQuaggaCommand(). with the selective noerr fixed,
we can now fail on return code.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Vyatta/Quagga/Config.pm | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm index 8b463bf4..4eee2e8f 100644 --- a/lib/Vyatta/Quagga/Config.pm +++ b/lib/Vyatta/Quagga/Config.pm @@ -202,30 +202,24 @@ sub cmpb { $b cmp $a } # properly format a Quagga command for vtysh and send to Quagga # input: $1 - qVarReplaced Quagga Command string +# $2 - boolean: should we use noerr? # output: none, return failure if needed sub _sendQuaggaCommand { my ($command, $noerr) = @_; - if ($noerr) { $noerr = '--noerr'; } - my $args = "$_vtyshexe $noerr -c 'configure terminal' "; + my @arg_array = ("$_vtyshexe"); + if ($noerr) { push (@arg_array, '--noerr'); } + if ($_DEBUG >= 2) { push (@arg_array, '-E'); } + push (@arg_array, '-c'); + push (@arg_array, 'configure terminal'); my @commands = split / ; /, $command; foreach my $section (@commands) { - $args .= "-c '$section' "; + push (@arg_array, '-c'); + push (@arg_array, "$section"); } - if ($_DEBUG >= 2) { print "DEBUG: _sendQuaggaCommand - args prior to system call - $args\n"; } - # TODO: need to fix this system call. split into command and args. - system("$args"); - if ($? != 0) { - # TODO: need to fix to return error on output and error codes. - if ($_DEBUG) { - print "DEBUG: _sendQuaggaCommand - vtysh failure $? - $args\n"; - print "\n"; - } - return 0; - } - + system(@arg_array) == 0 or die "_sendQuaggaCommand: @arg_array failed: $?"; return 1; } |