Commit 9b9149cf authored by Leigh B Stoller's avatar Leigh B Stoller

Add a new section to the blob returned by Resolve on a slice/sliver at

the CM; we return the entire set of logins (keys) that were included
when the sliver was created. Format looks like:

	keys => [{'urn'   => $urn.
	          'login' => $login,
		  'keys'  => [...] },
		 {'urn'   => $urn.
	          'login' => $login,
		  'keys'  => [...] }];

This is *not* integrated with the AM yet.
parent f352b4d5
......@@ -4498,6 +4498,49 @@ sub HasNonLocalUsers($)
}
}
#
# Nonlocal users for this experiment.
#
sub NonLocalUsers($$)
{
my ($self, $pref) = @_;
my @result = ();
# Must be a real reference.
return -1
if (!ref($self));
my $idx = $self->idx();
#
# Need to find the pubkeys, so need a list of current bindings.
#
my $query_result =
DBQueryWarn("select uid,uid_idx,urn from nonlocal_user_accounts ".
"where exptidx='$idx'");
return -1
if (!$query_result);
while (my ($uid, $uid_idx, $urn) = $query_result->fetchrow_array()) {
my $pubkeys_result =
DBQueryWarn("select pubkey from nonlocal_user_pubkeys ".
"where uid_idx='$uid_idx'");
return -1
if (!$pubkeys_result);
my @pubkeys = ();
while (my ($pubkey) = $pubkeys_result->fetchrow_array()) {
push(@pubkeys, {'type' => 'ssh',
'key' => $pubkey});
}
push(@result, {"urn" => $urn,
"login" => $uid,
"keys" => \@pubkeys});
}
$$pref = \@result;
return 0;
}
#
# Return physical interfaces for a link in an experiment.
#
......
......@@ -221,6 +221,20 @@ sub Resolve($)
if (defined($manifest)) {
$blob->{'manifest'} = $manifest;
}
# For key bindings.
my $slice_experiment = $slice->GetExperiment();
if (!defined($slice_experiment)) {
print STDERR "*** No Experiment for $slice\n";
}
else {
my $bindings;
if ($slice_experiment->NonLocalUsers(\$bindings)) {
print STDERR "*** No bindings for $slice_experiment\n";
}
elsif (@{ $bindings }) {
$blob->{'keys'} = $bindings;
}
}
}
my $ticket = GeniTicket->SliceTicket($slice);
if (defined($ticket)) {
......@@ -255,6 +269,20 @@ sub Resolve($)
my $blob = { "urn" => $urn,
"manifest" => $manifest,
};
# For key bindings.
my $slice_experiment = $slice->GetExperiment();
if (!defined($slice_experiment)) {
print STDERR "*** No Experiment for $slice\n";
}
else {
my $bindings;
if ($slice_experiment->NonLocalUsers(\$bindings)) {
print STDERR "*** No bindings for $slice_experiment\n";
}
elsif (@{ $bindings }) {
$blob->{'keys'} = $bindings;
}
}
return GeniResponse->Create(GENIRESPONSE_SUCCESS, $blob);
}
if ($type eq "ticket") {
......
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