Commit c6bfef74 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add front parsing support for tb-set-node-tarfiles

parent a2bdcd01
......@@ -202,6 +202,31 @@ foreach (split("\n",&ir_get("/rpms"))) {
$sth->execute;
$sth->finish;
}
if (! &ir_exists("/tarfiles")) {
print STDERR "IR incomplete: No /tarfiles.\n";
exit(1);
}
foreach (split("\n",&ir_get("/tarfiles"))) {
my $tarfiles = "";
($node,$dirsandfiles) = /^([^ ]+)(.*)$/;
$dirsandfiles =~ s/^ //;
@line = split(" ", $dirsandfiles);
while (@line) {
$dir = shift(@line);
$tar = shift(@line);
if ($tarfiles eq "") {
$tarfiles = "$dir $tar";
}
else {
$tarfiles = "$tarfiles:$dir $tar";
}
}
$sth = $dbh->prepare("UPDATE nodes set tarballs = \"$tarfiles\" ".
"where node_id = \"$nodemap{$node}\"");
$sth->execute;
$sth->finish;
}
if (! &ir_exists("/deltas")) {
print STDERR "IR incomplete: No /deltas.\n";
exit(1);
......
......@@ -100,6 +100,7 @@ $cmdlines = ();
$startups = ();
$rpms = ();
$deltas = ();
$tarfiles = ();
while (<TBCMD>) {
chop;
@line = split;
......@@ -195,7 +196,7 @@ while (<TBCMD>) {
$startups{$line[1]} = join(" ",@line[2..$#line]);
} elsif ($line[0] eq "tb-set-node-deltas") {
if ($#line < 2) {
push(@ERRORS,"Syntax: tb-set-node-deltas node rpms...");
push(@ERRORS,"Syntax: tb-set-node-deltas node deltas...");
next;
}
if (! defined($nodes{$line[1]})) {
......@@ -203,6 +204,17 @@ while (<TBCMD>) {
next;
}
$deltas{$line[1]} = join(" ",@line[2..$#line]);
} elsif ($line[0] eq "tb-set-node-tarfiles") {
if ($#line < 3 || ($#line - 1) % 2) {
push(@ERRORS, "Syntax: tb-set-node-tarfiles ".
"node dir tarfile [dir tarfile] ...");
next;
}
if (! defined($nodes{$line[1]})) {
push(@ERRORS,"$line[1] is not a valid node.");
next;
}
$tarfiles{$line[1]} = join(" ",@line[2..$#line]);
}
}
......@@ -294,6 +306,15 @@ foreach $node (keys(%nodes)) {
}
}
print IRFILE "END rpms\n";
print IRFILE "START tarfiles\n";
foreach $node (keys(%nodes)) {
if (defined($tarfiles{$node})) {
print IRFILE "$node $tarfiles{$node}\n";
} else {
print IRFILE "$node\n";
}
}
print IRFILE "END tarfiles\n";
print IRFILE "START startup\n";
foreach $node (keys(%nodes)) {
if (defined($startups{$node})) {
......
......@@ -74,6 +74,10 @@ proc tb-set-node-rpms {node args} {
global TBCMD
puts $TBCMD "tb-set-node-rpms $node $args"
}
proc tb-set-node-tarfiles {node args} {
global TBCMD
puts $TBCMD "tb-set-node-tarfiles $node $args"
}
proc tb-set-node-startup {node cmd} {
global TBCMD
puts $TBCMD "tb-set-node-startup $node $cmd"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment