Commit 499f6754 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add -f (force) option to force an update message to the source cluster.

Mostly for debugging.
parent b8b3c4a8
#!/usr/bin/perl -w
#
# Copyright (c) 2008-2015 University of Utah and the Flux Group.
# Copyright (c) 2008-2016 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -39,12 +39,13 @@ use Carp;
#
sub usage()
{
print "Usage: triggerimageupdate [-d] [-l] <image>\n";
print "Usage: triggerimageupdate [-d] [-l] [-f] <image>\n";
exit(1);
}
my $optlist = "dl";
my $optlist = "dlf";
my $debug = 0;
my $nolock = 0;
my $force = 0;
my $errormsg;
#
......@@ -84,6 +85,7 @@ use GeniHRN;
use libEmulab;
use Image;
use OSinfo;
require emdb;
if (!$PGENISUPPORT) {
print STDERR "You are not a protogeni site\n";
......@@ -107,6 +109,9 @@ if (defined($options{"d"})) {
if (defined($options{"l"})) {
$nolock = 1;
}
if (defined($options{"f"})) {
$force = 1;
}
usage()
if (!@ARGV);
......@@ -138,6 +143,23 @@ Genixmlrpc->SetTimeout(15);
if (!$nolock && $image->Lock()) {
fatal("Image is locked, cannot proceed");
}
if ($force) {
#
# Make sure we have an entry in the table, add one if not.
#
my $imageid = $image->imageid();
my $version = $image->version();
my $query_result =
emdb::DBQueryFatal("select * from image_notifications ".
"where imageid='$imageid' and version='$version'");
if (!$query_result->numrows) {
my $origin_uuid = $image->origin_uuid();
emdb::DBQueryWarn("replace into image_notifications set ".
" imageid='$imageid',version='$version', ".
" origin_uuid='$origin_uuid'");
}
}
if (GeniImage::TriggerUpdate($image, \$errormsg)) {
$image->Unlock()
if (!$nolock);
......
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