open DEBUG, ">/dev/null";
our $only;
+our $createlike;
+
+our @flags = qw(arch-amd64 arch-i386 arch-xen-amd64 arch-xen-i386
+ hvm purpose-build purpose-test
+ suite-wheezy);
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift @ARGV;
$|=1;
select(STDOUT);
$|=1;
+ } elsif (s/^-c(.)/$1/) {
+ $createlike = $_;
+ } elsif (s/^-f(.)/$1/) {
+ push @flags, $_;
} else {
die "bad option $_ ?";
}
"./mg-hosts setprops $machine -- $prop '$value'\n";
}
+our @machines;
+
while (my $row = $csv->getline_hr($fh)) {
print DEBUG Dumper($row);
next unless $machine =~ m/^([a-z]+) ([0-1])$/;
$machine = $1.$2;
+ outfor "mg-hosts equiv",
+ "./mg-hosts setflags $machine -- equiv-$1\n";
+
if (defined $only) {
next unless $only =~ m/\b$machine\b/;
}
print "# $machine\n";
+ push @machines, $machine;
+
eval {
my $ip = $row->{'IP addr'} or die "no ip\n";
$ip =~ m/^172\.16\.(144|145|146|147)\.(\d+)$/ or die "bad ip\n";
reportno 'Serial';
}
+if (defined $createlike) {
+ outfor "mg-hosts",
+ "./mg-hosts create-like $createlike ".(join ",", @machines)."\n";
+}
+
+if (@flags) {
+ outfor "mg-hosts",
+ "./mg-hosts setflags @machines -- @flags\n";
+}
+
close $fh or die $!;
foreach my $dest (sort { $dests{$a} <=> $dests{$b} } keys %dests) {