+Add error-id inclusion/exclustion management

Mapping between --error-id and --exclude-id options and errpt AIX options -j and -k
This commit is contained in:
Sims24 2015-10-05 12:48:47 +02:00
parent 4bb3ae1960
commit fab1f5bec1
1 changed files with 19 additions and 2 deletions

View File

@ -46,10 +46,12 @@ sub new {
"command-options:s" => { name => 'command_options', default => '' },
"error-type:s" => { name => 'error_type' },
"error-class:s" => { name => 'error_class' },
"error-id:s" => { name => 'error_id' },
"retention:s" => { name => 'retention' },
"timezone:s" => { name => 'timezone' },
"description" => { name => 'description' },
"filter-resource:s" => { name => 'filter_resource' },
"filter-resource:s" => { name => 'filter_resource' },
"exclude-id:s" => { name => 'exclude_id' },
});
$self->{result} = {};
return $self;
@ -58,6 +60,11 @@ sub new {
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{exclude_id}) && defined($self->{option_results}->{error_id})) {
$self->{output}->add_option_msg(short_msg => "Please use --error-id OR --exclude-id, these options are mutually exclusives");
$self->{output}->option_exit();
}
}
sub manage_selection {
@ -70,6 +77,12 @@ sub manage_selection {
if (defined($self->{option_results}->{error_class})){
$extra_options .= ' -d '.$self->{option_results}->{error_class};
}
if (defined($self->{option_results}->{error_id}) && $self->{option_results}->{error_id} ne ''){
$extra_options.= ' -j '.$self->{option_results}->{error_id};
}
if (defined($self->{option_results}->{exclude_id}) && $self->{option_results}->{exclude_id} ne ''){
$extra_options.= ' -k '.$self->{option_results}->{exclude_id};
}
if (defined($self->{option_results}->{retention}) && $self->{option_results}->{retention} ne ''){
my $retention = time() - $self->{option_results}->{retention};
if (defined($self->{option_results}->{timezone})){
@ -215,7 +228,7 @@ Filter error class ('H' for hardware, 'S' for software, '0' for errlogger, 'U' f
=item B<--error-id>
Filter specific error code
Filter specific error code (can be a comma separated list).
=item B<--retention>
@ -229,6 +242,10 @@ Print error description in long output. [ Error 'CODE' Date: Timestamp ResourceN
Filter resource (can use a regexp).
=item B<--exclude-id>
Filter on specific error code (can be a comma separated list).
=back
=cut