Author: arkurth Date: Fri Jun 19 18:30:46 2009 New Revision: 786614 URL: http://svn.apache.org/viewvc?rev=786614&view=rev Log: VCL-166 Changed how the Windows firewall subroutines check the output of running the netsh.exe commands. Previously, the last line of output had to be "Ok." in order for the subroutines to return true. Under some conditions, the last line is "The object already exists.". If this is the case the subs now return true.
Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm?rev=786614&r1=786613&r2=786614&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm Fri Jun 19 18:30:46 2009 @@ -3729,7 +3729,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow ping"); } elsif (defined($netsh_exit_status)) { @@ -3812,7 +3812,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow ping on private interface"); } elsif (defined($netsh_exit_status)) { @@ -3890,7 +3890,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to disallow ping"); } elsif (defined($netsh_exit_status)) { @@ -3980,7 +3980,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow SSH from $remote_ip"); } elsif (defined($netsh_exit_status)) { @@ -4065,7 +4065,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow SSH on private interface"); } elsif (defined($netsh_exit_status)) { @@ -4196,7 +4196,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow RDP from $remote_ip"); } elsif (defined($netsh_exit_status)) { @@ -4279,7 +4279,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to allow RDP on private interface"); } elsif (defined($netsh_exit_status)) { @@ -4357,7 +4357,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to disallow RDP"); } elsif (defined($netsh_exit_status)) { Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6.pm?rev=786614&r1=786613&r2=786614&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6.pm Fri Jun 19 18:30:46 2009 @@ -493,7 +493,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to enable ping from any address"); } elsif (defined($add_rule_exit_status)) { @@ -555,7 +555,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to allow incoming ping to: $private_ip_address"); } elsif (defined($add_rule_exit_status)) { @@ -600,7 +600,7 @@ # Execute the netsh.exe command my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "configured firewall to disallow ping"); } elsif (defined($netsh_exit_status)) { @@ -668,7 +668,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to enable RDP from $remote_ip"); } elsif (defined($add_rule_exit_status)) { @@ -732,7 +732,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to enable RDP to: $private_ip_address"); } elsif (defined($add_rule_exit_status)) { @@ -778,7 +778,7 @@ # Delete the firewall rule my ($netsh_exit_status, $netsh_output) = run_ssh_command($computer_node_name, $management_node_keys, $netsh_command); - if (defined($netsh_output) && @$netsh_output[-1] =~ /Ok\./i) { + if (defined($netsh_output) && @$netsh_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "deleted firewall rules which enable RDP"); } elsif (defined($netsh_output) && @$netsh_output[-1] =~ /No rules match/i) { @@ -839,7 +839,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to enable SSH from any address"); } elsif (defined($add_rule_exit_status)) { @@ -903,7 +903,7 @@ # Add the firewall rule my ($add_rule_exit_status, $add_rule_output) = run_ssh_command($computer_node_name, $management_node_keys, $add_rule_command); - if (defined($add_rule_output) && @$add_rule_output[-1] =~ /Ok\./i) { + if (defined($add_rule_output) && @$add_rule_output[-1] =~ /(Ok|The object already exists)/i) { notify($ERRORS{'OK'}, 0, "added firewall rule to enable SSH to: $private_ip_address"); } elsif (defined($add_rule_exit_status)) {