Commit 06e02fe5 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add force mode to re-register a node.

parent 3a31908c
...@@ -14,10 +14,11 @@ use Getopt::Std; ...@@ -14,10 +14,11 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print "Usage: register_resources [-c]\n"; print "Usage: register_resources [-f]\n";
exit(1); exit(1);
} }
my $optlist = ""; my $optlist = "f";
my $force = 0;
# Configure variables # Configure variables
my $TB = "@prefix@"; my $TB = "@prefix@";
...@@ -34,7 +35,9 @@ my %options = (); ...@@ -34,7 +35,9 @@ my %options = ();
if (! getopts($optlist, \%options)) { if (! getopts($optlist, \%options)) {
usage(); usage();
} }
if (defined($options{"f"})) {
$force = 1;
}
use vars qw($GENI_DBNAME); use vars qw($GENI_DBNAME);
$GENI_DBNAME = "geni-cm"; $GENI_DBNAME = "geni-cm";
...@@ -93,8 +96,6 @@ foreach my $node_id (@nodes) { ...@@ -93,8 +96,6 @@ foreach my $node_id (@nodes) {
die("*** $0:\n". die("*** $0:\n".
" Could not map $node_id to object\n"); " Could not map $node_id to object\n");
} }
print "Registering $node_id\n";
my $component = GeniComponent->Lookup($node->uuid()); my $component = GeniComponent->Lookup($node->uuid());
if (!defined($component)) { if (!defined($component)) {
$certificate = GeniCertificate->Lookup($node->uuid()); $certificate = GeniCertificate->Lookup($node->uuid());
...@@ -114,8 +115,12 @@ foreach my $node_id (@nodes) { ...@@ -114,8 +115,12 @@ foreach my $node_id (@nodes) {
" Could not create component object for $node\n"); " Could not create component object for $node\n");
} }
} }
elsif (!$force) {
next;
}
$certificate = $component->GetCertificate(); $certificate = $component->GetCertificate();
print "Registering $node_id\n";
if ($clearinghouse->Register("Component", if ($clearinghouse->Register("Component",
$certificate->cert(), {}) != 0) { $certificate->cert(), {}) != 0) {
die("*** $0:\n". die("*** $0:\n".
......
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