Skip to content

Commit

Permalink
allow the proxy to override the host group in the report
Browse files Browse the repository at this point in the history
  • Loading branch information
kouril committed Feb 21, 2019
1 parent 20f0abf commit 5cebeab
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pakiti-client
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,35 @@ sub main () {
} else {
$report = read_file($Option{"input"});
}
if ($Option{"site"}) {
my $rep = "";
my $site_recorded = 0;
my @lines = split /\n/, $report;
my $hashes = 0;
foreach my $line (@lines) {
my $tmp;
if ($line eq "#") {
$hashes++;
if ($hashes == 2) {
if (! $site_recorded) {
$tmp = sprintf("site: %s\n", $Option{"site"});
$rep .= $tmp;
}
}
}
if ($hashes == 1) {
my @header = split /:/, $line;
if ($header[0] eq "site") {
$tmp = sprintf("site: %s\n", $Option{"site"});
$rep .= $tmp;
$site_recorded = 1;
next;
}
}
$rep .= $line . "\n";
}
$report = $rep;
}
} else {
$data{version} = 1;
$data{site} = strip($Option{"site"}) if $Option{"site"};
Expand Down

0 comments on commit 5cebeab

Please sign in to comment.