+ enhance telnet options

This commit is contained in:
garnier-quentin 2016-08-01 16:10:39 +02:00
parent dc832594fd
commit a41dfdb6b2

View File

@ -75,7 +75,9 @@ sub check_options {
sub read_scenario { sub read_scenario {
my ($self, %options) = @_; my ($self, %options) = @_;
my $content_scenario = do { my $content_scenario;
if (-f $self->{option_results}->{scenario}) {
$content_scenario = do {
local $/ = undef; local $/ = undef;
if (!open my $fh, "<", $self->{option_results}->{scenario}) { if (!open my $fh, "<", $self->{option_results}->{scenario}) {
$self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{scenario} : $!"); $self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{scenario} : $!");
@ -83,6 +85,9 @@ sub read_scenario {
} }
<$fh>; <$fh>;
}; };
} else {
$content_scenario = $self->{option_results}->{scenario};
}
eval { eval {
$self->{json_scenario} = decode_json($content_scenario); $self->{json_scenario} = decode_json($content_scenario);
@ -171,7 +176,8 @@ Check telnet scenario execution
=item B<--scenario> =item B<--scenario>
Scenario used (Required) Scenario used (Required).
Can be a file or json content.
=item B<--timeout> =item B<--timeout>