Commit 315fb3c1 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Fix tarball and startup_command in rspecv2

parent f945336f
......@@ -966,7 +966,7 @@ sub GetTicketAuxAux($$$$$$$$$)
};
# Tarball and startup command.
my $startupcmd = GeniXML::GetText("startup_command", $ref);
my $startupcmd = GeniXML::GetStartupCommand($ref);
if (defined($startupcmd)) {
if (! TBcheck_dbslot($startupcmd, "virt_nodes", "startupcmd",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
......@@ -977,7 +977,7 @@ sub GetTicketAuxAux($$$$$$$$$)
}
$nodeblob->{'startupcmd'} = $startupcmd;
}
my $tarfiles = GeniXML::GetText("tarfiles", $ref);
my $tarfiles = GeniXML::GetTarball($ref);
if (defined($tarfiles)) {
if (! TBcheck_dbslot($tarfiles, "virt_nodes", "tarfiles",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
......
......@@ -15,7 +15,7 @@ use vars qw(@ISA @EXPORT);
FindFirst FindElement FindAttr GetNodeByVirtualId GetLinkByVirtualId
IsLanNode IsLocalNode IsTunnel GetExpires
GetNodeId GetVirtualId GetInterfaceId GetInterfaceNodeId GetSliverId
GetManagerId GetColocate GetSubnodeOf
GetManagerId GetColocate GetSubnodeOf GetStartupCommand GetTarball
GetVirtualizationType SetVirtualizationType GetVirtualizationSubtype
GetExclusive SetExclusive GetLinkManager SetText GetText Serialize
CreateDocument AddElement RemoveChild PolicyExists);
......@@ -365,6 +365,48 @@ sub GetSubnodeOf($)
return $result;
}
sub GetStartupCommand($)
{
my ($node) = @_;
my $result = undef;
if (IsVersion0($node)) {
$result = GetText("startup_command", $node);
} else {
my $execute = FindFirst("n:services/n:execute", $node);
$result = GetText("command", $execute);
}
return $result;
}
sub GetTarball($)
{
my ($node) = @_;
my $result = undef;
if (IsVersion0($node)) {
$result = GetText("tarfiles", $node);
} else {
$result = "";
my @tarlist = FindNodes("n:services/n:install",
$node)->get_nodelist();
foreach my $current (@tarlist) {
my $url = GetText("url", $current);
my $install = GetText("install_path", $current);
if (defined($url) && defined($install)) {
# TODO: Make sure url/install don't have semicolons or spaces
# TODO: Flag an error if either one is not defined
if ($result ne "") {
$result .= ";";
}
$result .= $install . " " . $url;
}
}
if ($result eq "") {
$result = undef;
}
}
return $result;
}
sub GetVirtualizationType($)
{
my ($node) = @_;
......
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