Commit 94132262 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Don't have a <login> clause in manifest if user did not specify ssh-keys.

parent 62a267fe
......@@ -4477,6 +4477,27 @@ sub BindNonLocalUser($$$$$$)
return 0;
}
sub HasNonLocalUsers($)
{
my ($self) = @_;
return 0
if (! ref($self));
my $exptidx = $self->idx();
my $query_result =
DBQueryWarn("select count(*) from nonlocal_user_accounts ".
"where exptidx='$exptidx'");
return 0
if (!$query_result);
if ($query_result->numrows) {
my ($count) = $query_result->fetchrow_array();
return $count > 0;
} else {
return 0;
}
}
#
# Return physical interfaces for a link in an experiment.
#
......
......@@ -780,19 +780,21 @@ sub AnnotateManifest($)
}
GeniXML::SetText("name", $host, $vhostname);
}
my $services = GeniXML::FindFirst("n:services", $rspec);
if (! defined($services)) {
$services = GeniXML::AddElement("services", $rspec);
}
my $login = GeniXML::FindFirst("n:login", $services);
if (! defined($login)) {
$login = GeniXML::AddElement("login", $services);
}
GeniXML::SetText("authentication", $login, "ssh-keys");
GeniXML::SetText("hostname", $login, $phostname);
GeniXML::SetText("port", $login, $sshdport);
GeniXML::SetText("username", $login, $user->uid());
if ($experiment->HasNonLocalUsers()) {
my $services = GeniXML::FindFirst("n:services", $rspec);
if (! defined($services)) {
$services = GeniXML::AddElement("services", $rspec);
}
my $login = GeniXML::FindFirst("n:login", $services);
if (! defined($login)) {
$login = GeniXML::AddElement("login", $services);
}
GeniXML::SetText("authentication", $login, "ssh-keys");
GeniXML::SetText("hostname", $login, $phostname);
GeniXML::SetText("port", $login, $sshdport);
GeniXML::SetText("username", $login, $user->uid());
}
if ($self->UpdateRspec($rspec)) {
print STDERR "Could not insert annotated manifest for node $self ".
......
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