* Fixed a bug in Words->parse_banged_string() where a variable being inserted that ended in a new-line would break the variable insertion into the string.

* Switched the icons for prep'ing a node or DR host and building an Anvil!.
* Started work on the node/dr host initial setup webUI.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent bc341809ca
commit db1afb766e
  1. 6
      Anvil/Tools/Words.pm
  2. 24
      cgi-bin/striker
  3. 64
      html/skins/alteeve/anvil.html
  4. BIN
      html/skins/alteeve/images/build-anvil_icon.png
  5. BIN
      html/skins/alteeve/images/prep-host_icon.png
  6. 6
      html/skins/alteeve/images/sources.txt
  7. 4
      share/words.xml
  8. 14
      tools/anvil-manage-firewall

@ -275,7 +275,11 @@ sub parse_banged_string
# Setup default values # Setup default values
my $out_string = ""; my $out_string = "";
my $key_string = defined $parameter->{key_string} ? $parameter->{key_string} : 0; my $key_string = defined $parameter->{key_string} ? $parameter->{key_string} : 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { key_string => $key_string }});
# If the string ended with newline before the final '!!', it will break things.
$key_string =~ s/\n!!/!!/gs;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { key_string => $key_string }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { key_string => $key_string }});
# There might be multiple keys, split by newlines. # There might be multiple keys, split by newlines.

@ -528,18 +528,24 @@ sub process_prep_host_page
{ {
my ($anvil) = @_; my ($anvil) = @_;
$anvil->data->{form}{refresh_link} = "?jobs=true&task=prep-host"; my $ip_address = defined $anvil->data->{cgi}{ip_address}{value} ? $anvil->data->{cgi}{ip_address}{value} : "";
$anvil->data->{form}{back_link} = "?jobs=true"; my $rh_user = defined $anvil->data->{cgi}{rh_user}{value} ? $anvil->data->{cgi}{rh_user}{value} : "";
my $rh_password = defined $anvil->data->{cgi}{rh_password}{value} ? $anvil->data->{cgi}{rh_password}{value} : "";
my $node_checked = "checked";
my $dr_checked = "";
my $form_body = $anvil->Template->get({file => "anvil.html", name => "host-setup-menu1", variables => {
ip_address => $ip_address,
node_checked => $node_checked,
dr_checked => $dr_checked,
}});
$anvil->data->{form}{refresh_link} = "?anvil=true&task=prep-host";
$anvil->data->{form}{back_link} = "?anvil=true";
$anvil->data->{cgi}{task}{value} = "" if not defined $anvil->data->{cgi}{task}{value}; $anvil->data->{cgi}{task}{value} = "" if not defined $anvil->data->{cgi}{task}{value};
$anvil->data->{cgi}{action}{value} = "" if not defined $anvil->data->{cgi}{action}{value}; $anvil->data->{cgi}{action}{value} = "" if not defined $anvil->data->{cgi}{action}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "jobs", variables => { $anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "prep-host-main", variables => {
title_id => "", form => $form_body,
message_id => "",
title => "#!string!striker_0096!#",
description => "#!string!striker_0115!#",
job_list => $anvil->Job->html_list({debug => 2, ended_within => 300}),
}}); }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'say::maintenance' => $anvil->data->{say}{maintenance} }});
return(0); return(0);
} }

@ -43,34 +43,70 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" class="title"> <td colspan="2" class="title">
#!string!striker_0117!# #!string!striker_0121!#
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
#!string!striker_0118!# &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
&nbsp; #!string!striker_0122!#
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="main_option_icon"> <td colspan="2">
<a href="?anvil=true&task=prep-host"><img src="#!data!skin::url!#/images/prep-host_icon.png" class="top_icon" ></a> &nbsp;
</td>
<td class="main_option">
<a href="?anvil=true&task=sync">#!string!striker_0116!#</a>
</td> </td>
</tr> </tr>
<form name="host_setup" action="" method="post">
<tr> <tr>
<td class="main_option_icon"> #!variable!form!#
<a href="?anvil=true&task=create"><img src="#!data!skin::url!#/images/build-anvil_icon.png" class="top_icon" ></a>
</td>
<td class="main_option">
<a href="?anvil=true&task=sync">#!string!striker_0114!#</a>
</td>
</tr> </tr>
<input type="hidden" name="anvil" id="anvil" value="1">
<input type="hidden" name="task" id="prep-host" value="1">
</form>
</table> </table>
<!-- end prep-host-main --> <!-- end prep-host-main -->
<!-- start host-setup-menu1 -->
<table align="center" class="anvil_main_menu">
<div id="host-setup">
<tr>
<td>
<input type="text" name="ip_address" id="ip_address" value="#!variable!ip_address!#" autocomplete="off" placeholder="#!string!striker_0024!#" />
</td>
<td>
&nbsp;
</td>
<td>
<input type="password" name="password" id="password" value="#!variable!password!#" autocomplete="off" placeholder="#!string!striker_0051!#" />
</td>
</tr>
<tr>
<td colspan="3">
<input type="radio" name="type" value="node" id="node" class="radio" #!variable!node_checked!#> #!string!message_0116!#" <br />
<input type="radio" name="type" value="dr" id="dr" class="radio" #!variable!dr_checked!#> #!string!message_0117!#"
</td>
</tr>
<tr>
<td>
<input type="text" name="rh_user" id="rh_user" value="#!variable!rh_user!#" placeholder="#!string!message_0144!#" />
</td>
<td>
&nbsp;
</td>
<td>
<input type="password" name="rh_password" id="rh_password" value="#!variable!rh_password!#" placeholder="#!string!message_0145!#" />
</td>
</tr>
<tr>
<td colspan="3">
<input type="submit" name="login" id="login" class="button" value="#!string!striker_0049!#">
</td>
</tr>
</div>
</table>
<!-- end host-setup-menu1 -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 37 KiB

@ -35,9 +35,6 @@ configure by Gregor Cresnar from the Noun Project (https://thenounproject.com/te
customize by Trusted Icons from the Noun Project (https://thenounproject.com/term/customize/538026/) customize by Trusted Icons from the Noun Project (https://thenounproject.com/term/customize/538026/)
- configure_icon.png - configure_icon.png
configure by iconesia from the Noun Project (https://thenounproject.com/term/configure/1651241/)
- build_icon.png
power by Blair Adams from the Noun Project (https://thenounproject.com/search/?q=power&i=865890) power by Blair Adams from the Noun Project (https://thenounproject.com/search/?q=power&i=865890)
- power_icon.png - power_icon.png
@ -51,6 +48,9 @@ Task by Ramesha from the Noun Project (https://thenounproject.com/term/task/1212
- tasks_icon.png - tasks_icon.png
Setup by Eucalyp from the Noun Project (https://thenounproject.com/term/setup/1453246/) Setup by Eucalyp from the Noun Project (https://thenounproject.com/term/setup/1453246/)
- build_icon.png
configure by iconesia from the Noun Project (https://thenounproject.com/term/configure/1651241/)
- prep-host_icon.png - prep-host_icon.png
Folder by Mint Shirt from the Noun Project (https://thenounproject.com/term/folder/402164/) Folder by Mint Shirt from the Noun Project (https://thenounproject.com/term/folder/402164/)

@ -248,6 +248,8 @@ About to try to download aproximately: [#!variable!packages!#] packages needed t
<key name="message_0141">Changing the default zone to: [#!variable!zone!#].</key> <key name="message_0141">Changing the default zone to: [#!variable!zone!#].</key>
<key name="message_0142">* Download progress: [#!variable!percentage!# %], Downloaded: [#!variable!downloaded!#], Current rate: [#!variable!current_rate!#], Average Rate: [#!variable!average_rate!#], Time Running: [#!variable!running_time!#], Estimated left: [#!variable!estimated_left!#].</key> <key name="message_0142">* Download progress: [#!variable!percentage!# %], Downloaded: [#!variable!downloaded!#], Current rate: [#!variable!current_rate!#], Average Rate: [#!variable!average_rate!#], Time Running: [#!variable!running_time!#], Estimated left: [#!variable!estimated_left!#].</key>
<key name="message_0143">The zone: [#!variable!zone!#]'s user-land file: [#!variable!file!#] exists. Skipping checking the configuration of this zone.</key> <key name="message_0143">The zone: [#!variable!zone!#]'s user-land file: [#!variable!file!#] exists. Skipping checking the configuration of this zone.</key>
<key name="message_0144">Red Hat user</key>
<key name="message_0145">Red Hat password</key>
<!-- Log entries --> <!-- Log entries -->
<key name="log_0001">Starting: [#!variable!program!#].</key> <key name="log_0001">Starting: [#!variable!program!#].</key>
@ -911,6 +913,8 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<key name="striker_0118">Prepare a new machine for use as an Anvil! node or DR (disaster recovery) host. This process will setup the repository, install the appropriate anvil packages and link it to the Anvil! databases on the Strikers you choose.</key> <key name="striker_0118">Prepare a new machine for use as an Anvil! node or DR (disaster recovery) host. This process will setup the repository, install the appropriate anvil packages and link it to the Anvil! databases on the Strikers you choose.</key>
<key name="striker_0119">Anvil! File Manager.</key> <key name="striker_0119">Anvil! File Manager.</key>
<key name="striker_0120">Saving File...</key> <key name="striker_0120">Saving File...</key>
<key name="striker_0121">Prepare Node or DR Host</key>
<key name="striker_0122">Please enter the IP address and root password of the target machine you want to configure.</key>
<!-- These are generally units and appended to numbers --> <!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key> <key name="suffix_0001">#!variable!number!#/sec</key>

@ -49,13 +49,13 @@ if (not $anvil->data->{sys}{manage}{firewall})
# Do nothing. # Do nothing.
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
} }
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 3, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
# Read switches # Read switches
$anvil->data->{switches}{'y'} = ""; $anvil->data->{switches}{'y'} = "";
$anvil->Get->switches; $anvil->Get->switches;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "message_0134"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 3, key => "message_0134"});
check_initial_setup($anvil); check_initial_setup($anvil);
### TODO: ### TODO:
@ -102,7 +102,7 @@ sub check_initial_setup
# Get the list of existing zones from iptables/firewalld. # Get the list of existing zones from iptables/firewalld.
$anvil->System->check_firewall({debug => 3}); $anvil->System->check_firewall({debug => 3});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "firewall::default_zone" => $anvil->data->{firewall}{default_zone} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "firewall::default_zone" => $anvil->data->{firewall}{default_zone} }});
my $internet_zone = ""; my $internet_zone = "";
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{sys}{network}{interface}}) foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{sys}{network}{interface}})
@ -151,7 +151,7 @@ sub check_initial_setup
{ {
my $file = exists $anvil->data->{firewall}{zone}{$zone}{file} ? $anvil->data->{firewall}{zone}{$zone}{file} : $anvil->data->{path}{directories}{firewalld_zones}."/".$zone.".xml"; my $file = exists $anvil->data->{firewall}{zone}{$zone}{file} ? $anvil->data->{firewall}{zone}{$zone}{file} : $anvil->data->{path}{directories}{firewalld_zones}."/".$zone.".xml";
my $user_file = $anvil->data->{path}{directories}{firewalld_zones_etc}."/".$zone.".xml"; my $user_file = $anvil->data->{path}{directories}{firewalld_zones_etc}."/".$zone.".xml";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
"s1:zone" => $zone, "s1:zone" => $zone,
"s2:file" => $file, "s2:file" => $file,
"s3:user_file" => $user_file, "s3:user_file" => $user_file,
@ -313,7 +313,7 @@ sub check_initial_setup
} }
# Do we need to update the default zone? # Do we need to update the default zone?
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
internet_zone => $internet_zone, internet_zone => $internet_zone,
"firewall::default_zone" => $anvil->data->{firewall}{default_zone}, "firewall::default_zone" => $anvil->data->{firewall}{default_zone},
}}); }});
@ -321,7 +321,7 @@ sub check_initial_setup
{ {
# What's the current default zone? # What's the current default zone?
my ($default_zone, $return_code) = $anvil->System->call({debug => 3, shell_call => $anvil->data->{path}{exe}{'firewall-cmd'}." --get-default-zone"}); my ($default_zone, $return_code) = $anvil->System->call({debug => 3, shell_call => $anvil->data->{path}{exe}{'firewall-cmd'}." --get-default-zone"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { default_zone => $default_zone, return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { default_zone => $default_zone, return_code => $return_code }});
if ($default_zone ne $anvil->data->{firewall}{default_zone}) if ($default_zone ne $anvil->data->{firewall}{default_zone})
{ {
@ -337,7 +337,7 @@ sub check_initial_setup
# NOTE: We may want to do machine-specific stuff down the road. # NOTE: We may want to do machine-specific stuff down the road.
my $type = $anvil->System->get_host_type(); my $type = $anvil->System->get_host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { type => $type }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { type => $type }});
return(0); return(0);
} }

Loading…
Cancel
Save