projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2888eb3
)
fix newlines in interface addition, throw some sort of error for duplicate addition...
author
ivan
<ivan>
Sat, 26 Feb 2011 01:44:10 +0000
(
01:44
+0000)
committer
ivan
<ivan>
Sat, 26 Feb 2011 01:44:10 +0000
(
01:44
+0000)
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
patch
|
blob
|
history
diff --git
a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
index
e7d3db1
..
4c3264e
100644
(file)
--- a/
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
+++ b/
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
@@
-132,9
+132,13
@@
sub add_interface {
#should just use a proper XML parser huh
#should just use a proper XML parser huh
+ my @ddx = split(/\n/, $self->_torrus_loadddx);
+
+ die "Torrus Service ID $serviceid in use\n"
+ if grep /^\s*$serviceid:/, @ddx;
+
my $newline = " $serviceid:$interface:Both:main,";
my $newline = " $serviceid:$interface:Both:main,";
- my @ddx = split(/\n/, $self->_torrus_loadddx);
my $new = '';
my $added = 0;
my $new = '';
my $added = 0;
@@
-149,10
+153,10
@@
sub add_interface {
while ( my $paramline = shift(@ddx) ) {
if ( $paramline =~ /^\s*<\/param>/ ) {
while ( my $paramline = shift(@ddx) ) {
if ( $paramline =~ /^\s*<\/param>/ ) {
- $new .= "$newline\n$paramline";
+ $new .= "$newline\n$paramline
\n
";
last; #paramline
} else {
last; #paramline
} else {
- $new .=
$paramline
;
+ $new .=
"$paramline\n"
;
}
}
}
}
@@
-165,7
+169,7
@@
sub add_interface {
qq( $newline\n").
qq( </param>\n);
}
qq( $newline\n").
qq( </param>\n);
}
- $new .=
$hostline
;
+ $new .=
"$hostline\n"
;
last; #hostline
}
last; #hostline
}
@@
-212,7
+216,7
@@
sub _torrus_newddx {
sub _torrus_reload {
my($self) = @_;
sub _torrus_reload {
my($self) = @_;
- #i should have better error checking
+ #i should
use IPC::Run and
have better error checking
system('torrus', 'devdiscover', "--in=$ddxfile");
system('torrus', 'devdiscover', "--in=$ddxfile");