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

Replace existing <services> and <ip> tags if they exist instead of adding a new one.

parent 98f6b70a
......@@ -2708,7 +2708,10 @@ sub SliverWorkAux($$$$$$$)
$sliverName = "sliver_id";
$macName = "mac_address";
if (defined($ipAddress) && $ipAddress ne "") {
my $child = GeniXML::AddElement("ip", $outref);
my $child = GeniXML::FindFirst("n:ip", $outref);
if (! defined($child)) {
$child = GeniXML::AddElement("ip", $outref);
}
GeniXML::SetText("address", $child, $ipAddress);
GeniXML::SetText("type", $child, "ipv4");
}
......
......@@ -680,8 +680,14 @@ sub Create($$$$$$)
if (defined($sshdport));
}
my $services = GeniXML::AddElement("services", $rspec);
my $login = GeniXML::AddElement("login", $services);
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);
......
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