(plugin) apps::controlm::restapi - mode jobs add option --job-name (#4304)
This commit is contained in:
parent
543919b1dc
commit
fe9c8b3118
|
@ -159,6 +159,7 @@ sub new {
|
||||||
'filter-folder:s' => { name => 'filter_folder' },
|
'filter-folder:s' => { name => 'filter_folder' },
|
||||||
'filter-type:s' => { name => 'filter_type' },
|
'filter-type:s' => { name => 'filter_type' },
|
||||||
'filter-name:s' => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
|
'job-name:s' => { name => 'job_name' },
|
||||||
'timezone:s' => { name => 'timezone' }
|
'timezone:s' => { name => 'timezone' }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -168,15 +169,23 @@ sub new {
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $get_param = ['application=*'];
|
||||||
|
if (defined($self->{option_results}->{job_name}) && $self->{option_results}->{job_name} ne '') {
|
||||||
|
push @$get_param, 'jobname=' . $self->{option_results}->{job_name};
|
||||||
|
} else {
|
||||||
|
push @$get_param, 'jobname=*';
|
||||||
|
}
|
||||||
my $jobs = $options{custom}->request_api(
|
my $jobs = $options{custom}->request_api(
|
||||||
endpoint => '/run/jobs/status',
|
endpoint => '/run/jobs/status',
|
||||||
get_param => ['jobname=*', 'application=*']
|
get_param => $get_param
|
||||||
);
|
);
|
||||||
|
|
||||||
my $current_time = time();
|
my $current_time = time();
|
||||||
$self->{global} = { total => 0, failed => 0, waiting => 0, succeeded => 0, executing => 0 };
|
$self->{global} = { total => 0, failed => 0, waiting => 0, succeeded => 0, executing => 0 };
|
||||||
$self->{jobs} = {};
|
$self->{jobs} = {};
|
||||||
foreach my $job (@{$jobs->{statuses}}) {
|
foreach my $job (@{$jobs->{statuses}}) {
|
||||||
|
next if (defined($self->{option_results}->{job_name}) && $self->{option_results}->{job_name} ne '' &&
|
||||||
|
$job->{name} ne $self->{option_results}->{job_name});
|
||||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||||
$job->{name} !~ /$self->{option_results}->{filter_name}/);
|
$job->{name} !~ /$self->{option_results}->{filter_name}/);
|
||||||
next if (defined($self->{option_results}->{filter_folder}) && $self->{option_results}->{filter_folder} ne '' &&
|
next if (defined($self->{option_results}->{filter_folder}) && $self->{option_results}->{filter_folder} ne '' &&
|
||||||
|
@ -265,6 +274,10 @@ Filter jobs by type (cannot be a regexp).
|
||||||
|
|
||||||
Filter jobs by job name (can be a regexp).
|
Filter jobs by job name (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--job-name>
|
||||||
|
|
||||||
|
Check exact job name (no regexp).
|
||||||
|
|
||||||
=item B<--timezone>
|
=item B<--timezone>
|
||||||
|
|
||||||
Set date timezone.
|
Set date timezone.
|
||||||
|
|
Loading…
Reference in New Issue