Merge pull request #1048 from DeterminateSystems/fixup-1003

Hydra::Helper::Nix::getMachines: add a test
This commit is contained in:
Graham Christensen
2021-10-24 21:38:38 -04:00
committed by GitHub
2 changed files with 80 additions and 4 deletions

View File

@ -344,11 +344,19 @@ sub getMachines {
next unless -e $machinesFile;
open(my $conf, "<", $machinesFile) or die;
while (my $line = <$conf>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
my @tokens = split /\s/, $line;
chomp($line);
$line =~ s/\#.*$//g;
next if $line =~ /^\s*$/;
my @tokens = split /\s+/, $line;
if (!defined($tokens[5]) || $tokens[5] eq "-") {
$tokens[5] = "";
}
my @supportedFeatures = split(/,/, $tokens[5] || "");
if (!defined($tokens[6]) || $tokens[6] eq "-") {
$tokens[6] = "";
}
my @mandatoryFeatures = split(/,/, $tokens[6] || "");
$machines{$tokens[0]} =
{ systemTypes => [ split(/,/, $tokens[1]) ]