Commit 428c9226 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add a -r option to remove any existing component/certificate and

regen.
parent 4a64493c
...@@ -14,11 +14,12 @@ use Getopt::Std; ...@@ -14,11 +14,12 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print "Usage: register_resources [-f]\n"; print "Usage: register_resources [-f] [-r]\n";
exit(1); exit(1);
} }
my $optlist = "f"; my $optlist = "fr";
my $force = 0; my $force = 0;
my $remove = 0;
# Configure variables # Configure variables
my $TB = "@prefix@"; my $TB = "@prefix@";
...@@ -38,6 +39,9 @@ if (! getopts($optlist, \%options)) { ...@@ -38,6 +39,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"f"})) { if (defined($options{"f"})) {
$force = 1; $force = 1;
} }
if (defined($options{"r"})) {
$remove = 1;
}
use vars qw($GENI_DBNAME); use vars qw($GENI_DBNAME);
$GENI_DBNAME = "geni-cm"; $GENI_DBNAME = "geni-cm";
...@@ -97,6 +101,10 @@ foreach my $node_id (@nodes) { ...@@ -97,6 +101,10 @@ foreach my $node_id (@nodes) {
" Could not map $node_id to object\n"); " Could not map $node_id to object\n");
} }
my $component = GeniComponent->Lookup($node->uuid()); my $component = GeniComponent->Lookup($node->uuid());
if (defined($component) && $remove) {
$component->Delete();
$component = undef;
}
if (!defined($component)) { if (!defined($component)) {
$certificate = GeniCertificate->Lookup($node->uuid()); $certificate = GeniCertificate->Lookup($node->uuid());
if (!defined($certificate)) { if (!defined($certificate)) {
......
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