From f6c56b6be124d1cddd55b82f4564010163c47c80 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Mon, 13 Jun 2016 11:36:47 +0200 Subject: [PATCH] [backend] fix and clean up schedulerarch handling --- src/backend/BSConfiguration.pm | 7 +++++-- src/backend/bs_repserver | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/backend/BSConfiguration.pm b/src/backend/BSConfiguration.pm index a0694eb6da1..28ec7c65dd1 100644 --- a/src/backend/BSConfiguration.pm +++ b/src/backend/BSConfiguration.pm @@ -36,17 +36,17 @@ $bsconfigvalues{'noproxy'} = 1 if defined $BSConfig::noproxy; $bsconfigvalues{'repodownload'} = 1 if defined $BSConfig::repodownload; $bsconfigvalues{'enable_download_on_demand'} = 1 if defined $BSConfig::enable_download_on_demand; $bsconfigvalues{'forceprojectkeys'} = 1 if defined $BSConfig::forceprojectkeys; +$bsconfigvalues{'schedulerarchs'} = 1 if defined $BSConfig::schedulerarchs; my $configurationid = ''; my $configuration_file = "$BSConfig::bsdir/configuration.xml"; my $confiuration_checked_once; -our $xml; sub update_from_configuration { my @s = stat($configuration_file); $configurationid = @s ? "$s[9]/$s[7]/$s[1]" : ''; - $xml = readxml($configuration_file, $BSXML::configuration, 1) || {}; + my $xml = readxml($configuration_file, $BSXML::configuration, 1) || {}; $BSConfig::obsname = $xml->{'name'} unless $bsconfigvalues{'obsname'}; $BSConfig::proxy = $xml->{'http_proxy'} unless $bsconfigvalues{'proxy'}; $BSConfig::noproxy = $xml->{'no_proxy'} unless $bsconfigvalues{'noproxy'}; @@ -57,6 +57,9 @@ sub update_from_configuration { if (!$bsconfigvalues{'forceprojectkeys'}) { $BSConfig::forceprojectkeys = ($xml->{'enforce_project_keys'} || '') eq 'on' ? 1 : 0; } + if (!$bsconfigvalues{'schedulerarchs'}) { + $BSConfig::schedulerarchs = $xml->{'schedulers'}->{'arch'} if $xml->{'schedulers'} && $xml->{'schedulers'}->{'arch'}; + } $BSConfig::obsname = "build.some.where" unless defined $BSConfig::obsname; } diff --git a/src/backend/bs_repserver b/src/backend/bs_repserver index 00952752e56..efa5a0840b4 100755 --- a/src/backend/bs_repserver +++ b/src/backend/bs_repserver @@ -2128,19 +2128,19 @@ sub forwardevent { writexml("$eventdir/$arch/.$evname.$$", "$eventdir/$arch/$evname", $ev, $BSXML::event); BSUtil::ping("$eventdir/$arch/.ping"); } else { - my @archs; - if ($BSConfiguration::xml->{'schedulers'} && $BSConfiguration::xml->{'schedulers'}->{'arch'}) { - # notify only active schedulers - @archs = @{$BSConfiguration::xml->{'schedulers'}->{'arch'}}; - } else { + BSConfiguration::check_configuration_once(); + my @archs = @{$BSConfig::schedulerarchs || []}; + if (!$BSConfig::schedulerarchs) { # unconfigured, fallback to all existing directories - @archs = ls($eventdir); + for my $a (ls($eventdir)) { + next if $a =~ /^\./; + next if $a eq 'publish' || $a eq 'repository' || $a eq 'watch' || $a eq 'signer' || $a eq 'dispatch' || $a eq 'service' || $a eq 'deltastore'; + next unless -d "$eventdir/$a"; + } } - for my $a (ls($eventdir)) { - next if $a =~ /^\./; - next unless -d "$eventdir/$a"; - next if $a eq 'publish' || $a eq 'repository' || $a eq 'watch' || $a eq 'signer' || $a eq 'dispatch' || $a eq 'service' || $a eq 'deltastore'; + for my $a (@archs) { eval { + mkdir_p("$eventdir/$a"); dirty($projid, $repoid, $a) if defined $repoid; writexml("$eventdir/$a/.$evname.$$", "$eventdir/$a/$evname", $ev, $BSXML::event); BSUtil::ping("$eventdir/$a/.ping");