* Made more progress on the peer database configuration page.

* Added a switch to tools/anvil-configure-striker to prevent reboots.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 458ef94851
commit 1ac1bc5ffb
  1. 39
      cgi-bin/home
  2. 24
      html/skins/alteeve/striker.html
  3. 12
      share/words.xml
  4. 4
      tools/anvil-configure-striker

@ -297,6 +297,7 @@ sub process_sync_page
my $peer_table = "";
foreach my $uuid (keys %{$anvil->data->{database}})
{
next if not $anvil->Validate->is_uuid({uuid => $uuid});
next if $uuid eq $host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { uuid => $uuid }});
@ -304,14 +305,52 @@ sub process_sync_page
my $port = $anvil->data->{database}{$uuid}{port} ? $anvil->data->{database}{$uuid}{port} : 5432;
my $name = $anvil->data->{database}{$uuid}{name} ? $anvil->data->{database}{$uuid}{name} : $anvil->data->{sys}{database}{name};
my $user = $anvil->data->{database}{$uuid}{user} ? $anvil->data->{database}{$uuid}{user} : $anvil->data->{sys}{database}{user};
my $ping = $anvil->data->{database}{$uuid}{ping} ? $anvil->data->{database}{$uuid}{ping} : 1;
my $password = $anvil->data->{database}{$uuid}{password} ? $anvil->data->{database}{$uuid}{password} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host => $host,
port => $port,
name => $name,
user => $user,
ping => $ping,
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
# Store it by name.
$anvil->data->{peers}{$host}{port} = $port;
$anvil->data->{peers}{$host}{name} = $name;
$anvil->data->{peers}{$host}{user} = $user;
$anvil->data->{peers}{$host}{ping} = $ping;
$anvil->data->{peers}{$host}{password} = $password;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"peers::${host}::port" => $anvil->data->{peers}{$host}{port},
"peers::${host}::name" => $anvil->data->{peers}{$host}{name},
"peers::${host}::ping" => $anvil->data->{peers}{$host}{ping},
"peers::${host}::password" => $anvil->Log->secure ? $anvil->data->{peers}{$host}{password} : $anvil->Words->string({key => "log_0186"}),
}});
}
# Now peers are sortable by host name.
foreach my $host (sort {$a cmp $b} keys %{$anvil->data->{peers}})
{
my $port = $anvil->data->{peers}{$host}{port};
my $name = $anvil->data->{peers}{$host}{name};
my $user = $anvil->data->{peers}{$host}{user};
my $ping = $anvil->data->{peers}{$host}{ping};
my $password = $anvil->data->{peers}{$host}{password};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host => $host,
port => $port,
name => $name,
user => $user,
ping => $ping,
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
$peer_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-entry", variables => {
access => $port eq 5432 ? $user."\@".$host : $user."\@".$host.":".$port,
ping_checked => $ping ? "checked" : "",
}});
}
# Build the menu.

@ -147,6 +147,20 @@
</td>
</tr>
#!variable!peer_table!#
<tr>
<td>
<input type="text" id="new_peer_access" name="new_peer_access" placeholder="#!string!striker_0069!#" />
</td>
<td>
#!string!striker_0071!# <input type="checkbox" id="new_peer_ping" name="new_peer_ping" checked />
</td>
<td>
#!string!striker_0072!# <input type="checkbox" id="new_peer_bidirection" name="new_peer_bidirection" checked />
</td>
<td align="center">
<input type="button" id="new_peer_save" name="new_peer_save" value="#!string!striker_0070!#" />
</td>
</tr>
</table>
</td>
</tr>
@ -159,13 +173,13 @@
#!variable!access!#
</td>
<td>
#!variable!ping!#
#!string!striker_0071!# <input type="checkbox" id="#!variable!access!#_ping" name="#!variable!access!#_ping" #!variable!ping_checked!# />
</td>
<td>
#!variable!save_button!#
<td align="center">
<input type="button" id="#!variable!access!#_save" name="#!variable!access!#_save" value="#!string!striker_0067!#" />
</td>
<td>
#!variable!delete_button!#
<td align="center">
<input type="button" id="#!variable!access!#_delete" name="#!variable!access!#_delete" value="#!string!striker_0068!#" />
</td>
</tr>
<!-- end striker-sync-entry -->

@ -319,7 +319,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<key name="header_0006">Up Order</key>
<key name="header_0007">Inbound Connections</key>
<key name="header_0008">Network</key>
<key name="header_0009">Peer Connection (user@host:port)</key>
<key name="header_0009">Peer Connections</key>
<key name="header_0010">Ping</key>
<key name="header_0011"></key>
@ -390,10 +390,12 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<key name="striker_0064">Help and support</key>
<key name="striker_0065"><![CDATA[Forgot your password?<br />Use '<span class="code">anvil-change-password</span>' from the console to reset it.]]></key>
<key name="striker_0066">Access to this machine via: [#!variable!network!#].</key>
<key name="striker_0067"></key>
<key name="striker_0068"></key>
<key name="striker_0069"></key>
<key name="striker_0070"></key>
<key name="striker_0067">Update</key>
<key name="striker_0068">Delete</key>
<key name="striker_0069">db_user@hostname_or_ip[:tcp_port]</key>
<key name="striker_0070">Add</key>
<key name="striker_0071">Ping before connect:</key>
<key name="striker_0072">Bi-directional:</key>
<!-- Strings used by jobs -->
<key name="job_0001">Configure Network</key>

@ -31,6 +31,7 @@ $anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
# Read switches
$anvil->data->{switches}{'no-reboot'} = 0;
$anvil->Get->switches;
# Paths
@ -85,8 +86,11 @@ $anvil->Database->insert_or_update_variables({
});
### TODO: This is only until we can get the damn networking stable on reconfigure.
if (not $anvil->data->{switches}{'no-reboot'})
{
# Reboot.
$anvil->System->call({shell_call => $anvil->data->{path}{exe}{'shutdown'}." --reboot now"});
}
$anvil->nice_exit({code => 0});

Loading…
Cancel
Save