enh(protocol/snmp): collection mode - config option with carriage return (#2996)
This commit is contained in:
parent
f2476711df
commit
47c8a21840
|
@ -153,7 +153,9 @@ sub read_config {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $content;
|
my $content;
|
||||||
if (-f $self->{option_results}->{config}) {
|
if ($self->{option_results}->{config} =~ /\n/m || ! -f "$self->{option_results}->{config}") {
|
||||||
|
$content = $self->{option_results}->{config};
|
||||||
|
} else {
|
||||||
$content = do {
|
$content = do {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
if (!open my $fh, '<', $self->{option_results}->{config}) {
|
if (!open my $fh, '<', $self->{option_results}->{config}) {
|
||||||
|
@ -162,8 +164,6 @@ sub read_config {
|
||||||
}
|
}
|
||||||
<$fh>;
|
<$fh>;
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
$content = $self->{option_results}->{config};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
|
|
Loading…
Reference in New Issue