This commit is contained in:
qgarnier 2021-02-04 16:53:21 +01:00 committed by GitHub
parent ca0234bb0e
commit 31728b5876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -86,6 +86,7 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-feature:s' => { name => 'filter_feature' }
});
return $self;
@ -105,13 +106,19 @@ sub manage_selection {
foreach my $feature (@{$result->{licenses}->{entry}}) {
$feature->{expires} = lc($feature->{expires});
if (defined($self->{option_results}->{filter_feature}) && $self->{option_results}->{filter_feature} ne '' &&
$feature->{feature} !~ /$self->{option_results}->{filter_feature}/) {
$self->{output}->output_add(long_msg => "skipping '" . $feature->{feature} . "': no matching feature.", debug => 1);
next;
}
# January 30, 2022
my $dt;
if ($feature->{expires} =~ /^(\w+)\s+(\d+).*?(\d+)$/) {
$dt = DateTime->new(year => $3, month => $months->{$1}, day => $2);
}
$self->{features}->{$feature->{feature}} = {
$self->{features}->{ $feature->{feature} } = {
feature => $feature->{feature},
expired => $feature->{expired},
expiry_date => $feature->{expires},
@ -135,6 +142,10 @@ Check features licensing.
=over 8
=item B<--filter-feature>
Filter license by feature (can be a regexp).
=item B<--warning-status>
Set warning threshold for status.

View File

@ -39,7 +39,7 @@ sub new {
'system' => 'network::paloalto::ssh::mode::system'
};
$self->{custom_modes}{ssh} = 'network::paloalto::ssh::custom::cli';
$self->{custom_modes}->{ssh} = 'network::paloalto::ssh::custom::cli';
return $self;
}