Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] --list-badhosts for bs_admin #2701

Merged
merged 2 commits into from
Feb 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/backend/bs_admin
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ BEGIN {
unshift @INC, "$wd";
}

use strict;
use POSIX;
use Data::Dumper;
use Getopt::Long;
Expand Down Expand Up @@ -370,7 +371,7 @@ sub insert_request_db {
$db->{'noindex'} = {'id' => 1};

my @rid = split ('/',$file);
$rid = $rid[-1];
my $rid = $rid[-1];
my $req = readxml("$requestdir/$rid", $BSXML::request, 1);
print "WARNING: unable to parse request: $rid!\n" unless $req;
$db->updateindex($rid, {}, $req || {});
Expand Down Expand Up @@ -427,6 +428,7 @@ sub check_constraints_xml {
sub check_meta_xml {
my ($project, $package) = @_;
my $file;
my $metadesc;

if (defined($package)){
$file = "$projectsdir/${project}.pkg/${package}.xml";
Expand Down Expand Up @@ -617,6 +619,8 @@ while (@ARGV) {
} elsif ($arg eq "--parse-build-desc") {
die("ERROR: need a file name as argument (spec, dsc or kiwi)!\n") if @ARGV < 1;
my $file = shift @ARGV;
my $cfile;
my $arch;
my $cf = $cfile = $arch = undef;
$arch = shift @ARGV if @ARGV > 0;
if (@ARGV > 0) {
Expand All @@ -633,7 +637,7 @@ while (@ARGV) {
print Dumper($ret);
} elsif ($arg eq "--dump-cache") {
if (@ARGV == 1) {
$fullfile = shift @ARGV;
my $fullfile = shift @ARGV;
die("ERROR: invalid filename (must end with .cache or .solv)\n") if $fullfile !~ /\.(?:solv|cache)$/;
dump_solv($fullfile) if $fullfile =~ /\.solv$/;
dump_nStore($fullfile) if $fullfile =~ /\.cache$/;
Expand Down Expand Up @@ -1029,8 +1033,9 @@ while (@ARGV) {
my ($hash, $desc) = split(/\s+/, $_);
next if !defined( $sourcefiles{$hash.'-'.$desc});
# open link file to look if it links to a file that will be deleted
my $link;
eval {
my $link = readxml($sourcefiles{$hash.'-'.$desc}, $BSXML::link);
$link = readxml($sourcefiles{$hash.'-'.$desc}, $BSXML::link);
} ;
if ($@) { warn "$@ whilst processing $treesfiles{$file}"; next; }
next if !defined $link->{"package"} || !defined $link->{"project"} || !defined $link->{"rev"};
Expand Down Expand Up @@ -1126,6 +1131,20 @@ while (@ARGV) {
print "$val\n";
} elsif ( $arg eq "--drop-badhosts" ) {
BSUtil::touch("$rundir/bs_dispatch.dropbadhosts");
} elsif ( $arg eq "--list-badhosts" ) {
if ( -f "$rundir/dispatch.badhosts" ) {
my $result = {};
my $badhosts = BSUtil::retrieve("$rundir/dispatch.badhosts");
print Dumper($badhosts);
#for my $key (keys(%{$badhosts})) {
# if ($key =~ s#^([^/]+/[^/]+/[^/]+/[^/]+)#$1# ) {
# $result->{$key}=1;
# }
#}
#for my $key (sort(keys($result))) { print "$key\n" }
} else {
print "No badhosts found\n";
}
} else {
echo_help();
exit(1)
Expand Down
5 changes: 5 additions & 0 deletions src/backend/bs_dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,12 @@ while (1) {
delete $badhost{$_};
}
}
BSUtil::store("$rundir/dispatch.badhosts",undef,\%badhost);
} else {
# we dont care if file doesn`t exists
unlink("$rundir/dispatch.badhosts");
}

filechecks();
}

Expand Down