Commit 4b2a6c4b authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add more checks in GeniCertificate->Create() to prevent duplicates

(this time for the urn). Also change the protoype to allow an error to
be returned.
parent 3d13311a
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -109,13 +109,15 @@ foreach my $node_id (@nodes) {
if (!defined($component)) {
$certificate = GeniCertificate->Lookup($node->uuid());
if (!defined($certificate)) {
$certificate = GeniCertificate->Create("Node",
GeniHRN::Generate(
$OURDOMAIN, "node",
${node_id} ),
"${PGENIDOMAIN}.${node_id}",
$TBOPS, $node->uuid(),
$cmcertificate->URL());
$certificate =
GeniCertificate->Create({'urn' =>
GeniHRN::Generate($OURDOMAIN,
"node",
${node_id}),
'hrn' => "${PGENIDOMAIN}.${node_id}",
'email'=> $TBOPS,
'uuid' => $node->uuid(),
'url' => $cmcertificate->URL()});
if (!defined($certificate)) {
die("*** $0:\n".
" Could not generate certificate for $node\n");
......
Supports Markdown
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