Commit 6b20fbb2 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix bitrot since we now use this from the expire daemon.

parent 3568dd62
#!/usr/bin/perl -w
#
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# Copyright (c) 2008-2013 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -36,11 +36,12 @@ use Getopt::Std;
#
sub usage()
{
print "Usage: cleanupslice idx | uuid\n";
print "Usage: cleanupticket [-f] idx | uuid\n";
exit(1);
}
sub fatal($);
my $optlist = "";
my $optlist = "f";
my $force = 0;
#
# Configure variables
......@@ -59,12 +60,19 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
$| = 1;
#
# We don't want to run this script unless its the real version.
#
if ($EUID != 0) {
die("*** $0:\n".
" Must be root! Maybe its a development version?\n");
}
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use GeniDB;
use GeniTicket;
use GeniUtil;
use GeniCM;
use Genixmlrpc;
use GeniCertificate;
......@@ -76,19 +84,13 @@ my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"f"})) {
$force = 1;
}
usage()
if (@ARGV != 1);
my $token = $ARGV[0];
# Map invoking user to object.
my $this_user = User->ThisUser();
if (! defined($this_user)) {
fatal("You ($UID) do not exist!");
}
if (!$this_user->IsAdmin()) {
fatal("You must be a testbed administrator to do this");
}
# Connect to the proper DB.
DBConnect(GENICM_DBNAME());
......@@ -108,7 +110,7 @@ if (!defined($ticket)) {
}
GeniUtil::FlipToGeniUser();
if ($ticket->Lock() != 0) {
if ($ticket->Lock() && !$force) {
fatal("Could not lock $ticket");
}
if ($ticket->Release(TICKET_PURGED)) {
......
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