Commit 89971250 authored by Jonathon Duerig's avatar Jonathon Duerig

Various bugfixes.

parent c9c70961
......@@ -31,7 +31,7 @@ include $(OBJDIR)/Makeconf
BIN_SCRIPTS = newosid moduserinfo newgroup newmmlist editexp editimageid \
editnodetype editsitevars newimageid editgroup \
newimageid_ez joinproject
newimageid_ez joinproject newscript
WEB_BIN_SCRIPTS = webnewosid webmoduserinfo webnewgroup webnewmmlist \
webeditexp webeditimageid webeditnodetype webeditsitevars \
webnewimageid webeditgroup webnewimageid_ez
......
......@@ -76,7 +76,7 @@ use OSinfo;
sub fatal($);
sub UserError(;$);
sub PrintResult($);
sub ModifyRow($);
sub ModifyRow($$);
sub RemoveRow($);
sub ResolveRow($);
sub CommitNode($);
......@@ -385,9 +385,9 @@ exit(0)
my $rowlist;
if ($args{"command"} eq "add") {
ModifyRow(undef);
ModifyRow($id, 0);
} elsif ($args{"command"} eq "update") {
ModifyRow($id);
ModifyRow($id, 1);
} elsif ($args{"command"} eq "rollback") {
RemoveRow($id);
} elsif ($args{"command"} eq "commit") {
......@@ -448,12 +448,12 @@ sub PrintResult($)
}
}
sub ModifyRow($)
sub ModifyRow($$)
{
my ($id) = @_;
my ($id, $isupdate) = @_;
my $query;
my $none_changed = 1;
if (defined($id)) {
if ($isupdate) {
$query = "UPDATE";
} else {
$query = "INSERT";
......@@ -461,7 +461,8 @@ sub ModifyRow($)
$query .= " $tabledb SET";
foreach $key (keys(%args)) {
my $value = $args{$key};
if ($key ne "table" && $key ne "command" && $key ne $tableid
if ($key ne "table" && $key ne "command"
&& (! $isupdate || $key ne $tableid)
&& defined($value)) {
if ($query ne "UPDATE $tabledb SET"
&& $query ne "INSERT $tabledb SET") {
......@@ -471,7 +472,7 @@ sub ModifyRow($)
$none_changed = 0;
}
}
if (defined($id)) {
if ($isupdate) {
$query .= " WHERE $tableid='$id'";
}
if ($none_changed == 1) {
......
#!/usr/bin/perl
use XML::LibXML;
use XML::LibXML::XPathContext;
use XML::LibXML::NodeList;
......@@ -24,6 +26,7 @@ my @iplist = <IP>;
my %control_ips = {};
my %ilo_ips = {};
foreach my $line (@iplist) {
chomp($line);
my @fields = split(/ /, $line);
my $node_id = $fields[0];
my $control = $fields[1];
......@@ -101,10 +104,18 @@ foreach my $current (values(%devices)) {
}
print NODE_FILE " <attribute name='node_id'><value>$node_id</value></attribute>\n";
print NODE_FILE " <attribute name='type'><value>dl360</value></attribute>\n";
print NODE_FILE " <attribute name='ip'><value>$ip</value></attribute>\n";
print NODE_FILE " <attribute name='IP'><value>$ip</value></attribute>\n";
print NODE_FILE " <attribute name='identifier'><value>$node_id</value></attribute>\n";
print NODE_FILE "</newnode>\n";
close(NODE_FILE);
open(NODE_FILE, ">$outpath/node.$node_id.commit");
print NODE_FILE "<newnode>\n";
print NODE_FILE " <attribute name='table'><value>node</value></attribute>\n";
print NODE_FILE " <attribute name='command'><value>commit</value></attribute>\n";
print NODE_FILE " <attribute name='id'><value>$id</value></attribute>\n";
print NODE_FILE "</newnode>\n";
close(NODE_FILE);
}
# Print interfaces
......
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