Commit c4dfbae0 authored by Mike Hibler's avatar Mike Hibler

Add two more state transitions to make POWEROFF clear SECVIOLATIONS.

parent b31df8b4
......@@ -685,6 +685,8 @@ REPLACE INTO state_transitions VALUES ('PXEFBSD','MFSSETUP','SHUTDOWN','Error');
REPLACE INTO state_transitions VALUES ('PXEFBSD','ISUP','SHUTDOWN','Reboot');
REPLACE INTO state_transitions VALUES ('PXEFBSD','SHUTDOWN','PXEBOOTING','DHCP');
REPLACE INTO state_transitions VALUES ('SECURELOAD','TPMSIGNOFF','GPXEBOOTING','ReloadDone');
REPLACE INTO state_transitions VALUES ('SECUREBOOT','SHUTDOWN','GPXEBOOTING','QuoteOK');
REPLACE INTO state_transitions VALUES ('SECUREBOOT','SHUTDOWN','SECVIOLATION','QuoteFailed');
--
-- Dumping data for table `state_triggers`
......
#
# More state transitions so we can recover from SECVIOLATION via POWEROFF.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my @mode_transitions = (
);
my @timeouts = (
);
my @transitions = (
["SECUREBOOT","SHUTDOWN","GPXEBOOTING","QuoteOK"],
["SECUREBOOT","SHUTDOWN","SECVIOLATION","QuoteFailed"],
);
my @triggers = (
);
foreach my $row (@mode_transitions) {
my ($opm1,$s1,$opm2,$s2,$lab) = @$row;
my $query_result =
DBQueryFatal("SELECT op_mode1 FROM mode_transitions WHERE ".
"op_mode1='$opm1' AND state1='$s1' AND ".
"op_mode2='$opm2' AND state2='$s2'");
if ($query_result->numrows == 0) {
DBQueryFatal("INSERT INTO mode_transitions VALUES ".
"('$opm1','$s1','$opm2', '$s2','$lab')");
}
}
foreach my $row (@timeouts) {
my ($opm,$s,$to,$act) = @$row;
my $query_result =
DBQueryFatal("SELECT op_mode FROM state_timeouts WHERE ".
"op_mode='$opm' AND state='$s'");
if ($query_result->numrows == 0) {
DBQueryFatal("INSERT INTO state_timeouts VALUES ".
"('$opm','$s','$to', '$act')");
}
}
foreach my $row (@transitions) {
my ($opm,$s1,$s2,$lab) = @$row;
my $query_result =
DBQueryFatal("SELECT op_mode FROM state_transitions WHERE ".
"op_mode='$opm' AND state1='$s1' AND state2='$s2'");
if ($query_result->numrows == 0) {
DBQueryFatal("INSERT INTO state_transitions VALUES ".
"('$opm','$s1','$s2','$lab')");
}
}
foreach my $row (@triggers) {
my ($node,$opm,$s,$trig) = @$row;
my $query_result =
DBQueryFatal("SELECT node_id FROM state_triggers WHERE ".
"node_id='$node' AND op_mode='$opm' AND state='$s'");
if ($query_result->numrows == 0) {
DBQueryFatal("INSERT INTO state_triggers VALUES ".
"('$node','$opm','$s','$trig')");
}
}
return 0;
}
1;
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