Commit 440f399a authored by Mike Hibler's avatar Mike Hibler
Browse files

Add hack -G option to generate root keypair for an existing experiment.

parent ce2c4542
......@@ -38,12 +38,14 @@ sub usage()
"-d Turn on debugging\n".
"-n Impotent mode\n".
"-e Push key to all nodes in given experiment\n".
"-G Generate keypair in DB if it doesn't already exist\n".
"node ... Nodes push key to (must all be in same experiment)\n");
exit(-1);
}
my $optlist = "dne:";
my $optlist = "dne:G";
my $debug = 0;
my $impotent = 0;
my $genkeys = 0;
my $exptstr;
#
......@@ -92,6 +94,9 @@ if (defined($options{"n"})) {
if (defined($options{"e"})) {
$exptstr = $options{"e"};
}
if (defined($options{"G"})) {
$genkeys = 1;
}
if (@ARGV == 0 && !$exptstr) {
print STDERR "Must specify either an experiment or a list of nodes\n";
usage();
......@@ -100,6 +105,10 @@ if (@ARGV > 0 && $exptstr) {
print STDERR "Cannot specify both an experiment and nodes\n";
usage();
}
if ($genkeys && !$exptstr) {
print STDERR "Can only use -G with -e\n";
usage();
}
# Load the Testbed support stuff.
use lib "@prefix@/lib";
......@@ -130,6 +139,17 @@ if ($exptstr) {
}
}
#
# Generate the keys if needed
#
if ($genkeys) {
my $key = $expt->GetPrivkey();
if (!$key) {
print STDERR "Generating root keypair for $exptstr ...\n";
$expt->GenerateKeys();
}
}
my @nodeids = ();
foreach my $node (@nodes) {
my $nodeid = $node->node_id();
......
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