diff --git a/lib/OpenQA/WebAPI.pm b/lib/OpenQA/WebAPI.pm index af948b6bdf58..5c3a6e978b39 100644 --- a/lib/OpenQA/WebAPI.pm +++ b/lib/OpenQA/WebAPI.pm @@ -382,7 +382,6 @@ sub startup ($self) { my $worker_r = $api_ro->any('/workers/'); push @api_routes, $worker_r; $api_public_r->any('/workers/')->get('/')->name('apiv1_worker')->to('worker#show'); - $worker_r->post('/commands/')->name('apiv1_create_command')->to('command#create'); $api_ro->delete('/workers/')->name('apiv1_worker_delete')->to('worker#delete'); # api/v1/mutex diff --git a/lib/OpenQA/WebAPI/Controller/API/V1/Command.pm b/lib/OpenQA/WebAPI/Controller/API/V1/Command.pm deleted file mode 100644 index 7ea8200cf021..000000000000 --- a/lib/OpenQA/WebAPI/Controller/API/V1/Command.pm +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2015 SUSE LLC -# SPDX-License-Identifier: GPL-2.0-or-later - -package OpenQA::WebAPI::Controller::API::V1::Command; -use Mojo::Base 'Mojolicious::Controller'; - -use OpenQA::Utils; - -=pod - -=head1 NAME - -OpenQA::WebAPI::Controller::API::V1::Command - -=head1 SYNOPSIS - - use OpenQA::WebAPI::Controller::API::V1::Command; - -=head1 DESCRIPTION - -Implements API methods for openQA commands. - -=head1 METHODS - -=over 4 - -=item create() - -Sends a command to a worker. Receives the worker id and the command as arguments. Returns not -found if the worker cannot be found or a 200 status code and a JSON with an OK status of 1 on -success. - -=back - -=cut - -sub create { - my $self = shift; - my $workerid = $self->stash('workerid'); - my $command = $self->param('command'); - my $worker = $self->schema->resultset('Workers')->find($workerid); - - if (!$worker) { - log_warning("Trying to send command \'$command\' to unknown worker id $workerid"); - $self->reply->not_found; - } - - # command is sent async, hence no error handling - $worker->send_command(command => $command); - $self->render(json => {ok => 1}, status => 200); -} - -1;