Skip to content

Commit

Permalink
[backend] proxy the missingdodresources request through the src server
Browse files Browse the repository at this point in the history
This is the only POST request from the scheduler to a repo server.
It currently gets rejected due to our access configuration, so
use the src server as proxy.
  • Loading branch information
mlschroe committed May 31, 2021
1 parent ef5f0e0 commit 32d90d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/backend/BSSched/DoD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@ sub signalmissing {
my $proj = $remoteprojs->{$projid};
return unless $proj;
return unless $proj->{'partition'}; # not supported yet
my $server = $proj->{'partition'} ? $proj->{'remoteurl'} : $BSConfig::srcserver;
my $param = {
'uri' => "$server/build/$prp/$arch",
'uri' => "$BSConfig::srcserver/build/$prp/$arch/_repository",
'request' => 'POST',
'receiver' => \&BSHTTP::null_receiver,
'async' => {
Expand All @@ -443,7 +442,7 @@ sub signalmissing {
'_prp' => $prp,
},
};
my @args = 'view=missingdodresources';
my @args = 'cmd=missingdodresources';
push @args, map {"resource=$_"} @$dodresources;
push @args, "partition=$BSConfig::partition" if $BSConfig::partition;
eval { $ctx->xrpc("missingdodresources/$prp", $param, undef, @args) };
Expand Down
16 changes: 16 additions & 0 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -5436,6 +5436,21 @@ sub postrepo {
return ($res, $BSXML::collection);
}

sub missingdodresources {
my ($cgi, $projid, $repoid, $arch) = @_;
checkprojrepoarch($projid, $repoid, $arch);
my $reposerver = $BSConfig::partitioning ? BSSrcServer::Partition::projid2reposerver($projid) : $BSConfig::reposerver;
my $param = {
'uri' => "$reposerver/build/$projid/$repoid/$arch/_repository",
'request' => 'POST',
'ignorestatus' => 1,
'receiver' => \&BSServer::reply_receiver,
};
my @args = BSRPC::args($cgi, 'resource', 'partition');
BSWatcher::rpc($param, undef, 'cmd=missingdodresources', @args);
return undef;
}

####################################################################

sub service {
Expand Down Expand Up @@ -7218,6 +7233,7 @@ my $dispatches = [
'/build/$project/$repository/$arch package* view:?' => \&getpackagelist_build,
'!- /build/$project/$repository/$arch/_builddepinfo package* view:?' => \&getbuilddepinfo,
'/build/$project/$repository/$arch/_jobhistory package* code:* limit:num? endtime_start:num? endtime_end:num?' => \&getjobhistory,
'POST:/build/$project/$repository/$arch/_repository cmd=missingdodresources resource:* partition:?' => \&missingdodresources,
'POST:/build/$project/$repository/$arch/_repository match:' => \&postrepo,
'POST:/build/$project/$repository/$arch/$package cmd=copy oproject:project? opackage:package? orepository:repository? setupdateinfoid:? resign:bool? setrelease:? multibuild:bool?' => \&copybuild,
'POST:/build/$project/$repository/$arch/$package' => \&uploadbuild,
Expand Down

0 comments on commit 32d90d2

Please sign in to comment.