Skip to content

Commit

Permalink
[backend] fix and clean up schedulerarch handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Jun 13, 2016
1 parent 9545cd5 commit f6c56b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
7 changes: 5 additions & 2 deletions src/backend/BSConfiguration.pm
Expand Up @@ -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'};
Expand All @@ -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;
}

Expand Down
20 changes: 10 additions & 10 deletions src/backend/bs_repserver
Expand Up @@ -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");
Expand Down

0 comments on commit f6c56b6

Please sign in to comment.