(fix): add check option of resource-type (#2151)

This commit is contained in:
pkriko 2020-08-13 12:14:12 +02:00 committed by GitHub
parent 8e9b1ddc4b
commit 08a5b67b5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,14 @@ sub new {
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') {
$self->{option_results}->{resource_type} = 'device';
}
if ($self->{option_results}->{resource_type} !~ /^device|network$/) {
$self->{output}->add_option_msg(short_msg => 'unknown resource type');
$self->{output}->option_exit();
}
}
sub discovery_devices {