Commit 89971250 authored by Jonathon Duerig's avatar Jonathon Duerig

Various bugfixes.

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