Author: arkurth
Date: Tue May 30 17:40:17 2017
New Revision: 1796901
URL: http://svn.apache.org/viewvc?rev=1796901&view=rev
Log:
VCL-1031
Removed setting of default gateway in ifcfg file in
Linux.pm::set_static_public_address. This sub calls set_static_default_gateway
so it doesn't need to be explicitly set in the ifcfg file. It also wasn't using
OS.pm::get_correct_default_gateway.
Removed optional $default_gateway argument from
Linux.pm::set_static_default_gateway to eliminate duplicate logic in figuring
out which address to use.
Changed Ubuntu.pm::set_static_public_address and
Windows.pm::set_static_public_address to call
OS.pm::get_correct_default_gateway instead of
get_management_node_public_default_gateway.
Modified:
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1796901&r1=1796900&r2=1796901&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Tue May 30 17:40:17 2017
@@ -853,7 +853,6 @@ sub set_static_public_address {
my $ip_configuration =
$self->data->get_management_node_public_ip_configuration();
my $public_ip_address = $self->data->get_computer_public_ip_address();
my $subnet_mask = $self->data->get_management_node_public_subnet_mask();
- my $default_gateway =
$self->data->get_management_node_public_default_gateway();
my @dns_servers = $self->data->get_management_node_public_dns_servers();
# TODO: Get this out of here. OS modules shouldn't have to figure this
out. $self->data should always return correct value.
@@ -861,7 +860,6 @@ sub set_static_public_address {
if ($server_request_fixed_ip) {
$public_ip_address = $server_request_fixed_ip;
$subnet_mask = $self->data->get_server_request_netmask();
- $default_gateway = $self->data->get_server_request_router();
@dns_servers = $self->data->get_server_request_dns_servers();
}
@@ -878,13 +876,9 @@ sub set_static_public_address {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve public subnet
mask to assign to $computer_name");
return;
}
- elsif (!$default_gateway) {
- notify($ERRORS{'WARNING'}, 0, "failed to retrieve default
gateway to assign to $computer_name");
- return;
- }
# Determine the public interface name
- my $public_interface_name = $self->get_public_interface_name();
+ my $public_interface_name = $self->get_public_interface_name();
if (!$public_interface_name) {
notify($ERRORS{'WARNING'}, 0, "unable to set static public IP
address, public interface name could not be determined");
return;
@@ -915,15 +909,13 @@ sub set_static_public_address {
notify($ERRORS{'DEBUG'}, 0, "attempting to set static public IP
address on $computer_name:\n" .
"interface: $public_interface_name\n" .
"IP address: $public_ip_address\n" .
- "subnet mask: $subnet_mask\n" .
- "default gateway: $default_gateway"
+ "subnet mask: $subnet_mask"
);
my $ifcfg_parameters = {
bootproto => 'static',
ipaddr => $public_ip_address,
netmask => $subnet_mask,
- gateway => $default_gateway,
};
if (!$self->generate_ifcfg_file($public_interface_name,
$ifcfg_parameters)) {
@@ -939,7 +931,7 @@ sub set_static_public_address {
}
# Set default gateway
- if (!$self->set_static_default_gateway($default_gateway,
$public_interface_name)) {
+ if (!$self->set_static_default_gateway()) {
notify($ERRORS{'WARNING'}, 0, "failed to set static public IP
address on $computer_name, default gateway could not be set");
return;
}
@@ -1142,10 +1134,9 @@ sub delete_default_gateway {
=head2 set_static_default_gateway
- Parameters : $default_gateway (optional)
+ Parameters : none
Returns : boolean
- Description : Sets the default route. If no interface argument is supplied,
the
- public interface is used.
+ Description : Sets the default route.
=cut
@@ -1158,9 +1149,9 @@ sub set_static_default_gateway {
my $computer_name = $self->data->get_computer_short_name();
- my $default_gateway = shift || $self->get_correct_default_gateway();
+ my $default_gateway = $self->get_correct_default_gateway();
if (!$default_gateway) {
- notify($ERRORS{'WARNING'}, 0, "unable to set static default
gateway on $computer_name, argument was not supplied and correct default
gateway IP address could not be determined");
+ notify($ERRORS{'WARNING'}, 0, "unable to set static default
gateway on $computer_name, correct default gateway IP address could not be
determined");
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm?rev=1796901&r1=1796900&r2=1796901&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm Tue May 30
17:40:17 2017
@@ -376,9 +376,10 @@ sub set_static_public_address {
my $public_ip_configuration =
$self->data->get_management_node_public_ip_configuration();
my $public_ip_address =
$self->data->get_computer_public_ip_address();
my $public_subnet_mask =
$self->data->get_management_node_public_subnet_mask();
- my $public_default_gateway =
$self->data->get_management_node_public_default_gateway();
my @public_dns_servers =
$self->data->get_management_node_public_dns_servers();
+ my $public_default_gateway = $self->get_correct_default_gateway();
+
my $server_request_fixed_ip =
$self->data->get_server_request_fixed_ip();
if ($server_request_fixed_ip) {
$public_ip_address = $server_request_fixed_ip;
@@ -390,10 +391,6 @@ sub set_static_public_address {
notify($ERRORS{'WARNING'}, 0, "unable to set static
public IP address to $public_ip_address on $computer_name, server request fixed
IP is set but server request subnet mask could not be retrieved");
return;
}
- elsif (!$public_default_gateway) {
- notify($ERRORS{'WARNING'}, 0, "unable to set static
public IP address to $public_ip_address on $computer_name, server request fixed
IP is set but server request default gateway could not be retrieved");
- return;
- }
elsif (!@public_dns_servers) {
notify($ERRORS{'WARNING'}, 0, "unable to set static
public IP address to $public_ip_address on $computer_name, server request fixed
IP is set but server request DNS servers could not be retrieved");
return;
@@ -406,7 +403,6 @@ sub set_static_public_address {
}
}
-
# Get the public interface name
my $public_interface_name = $self->get_public_interface_name();
if (!$public_interface_name) {
@@ -534,7 +530,7 @@ sub set_static_public_address {
}
# Set the default gateway
- if (!$self->set_static_default_gateway($public_default_gateway,
$public_interface_name)) {
+ if (!$self->set_static_default_gateway()) {
notify($ERRORS{'WARNING'}, 0, "failed to set static public IP
address to $public_ip_address on $computer_name, failed to set the default
gateway");
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1796901&r1=1796900&r2=1796901&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Tue May 30 17:40:17
2017
@@ -8509,7 +8509,7 @@ sub set_static_public_address {
my $interface_name = $self->get_public_interface_name() ||
'<undefined>';
my $computer_public_ip_address =
$self->data->get_computer_public_ip_address() || '<undefined>';
my $subnet_mask = $self->data->get_management_node_public_subnet_mask()
|| '<undefined>';
- my $default_gateway =
$self->data->get_management_node_public_default_gateway() || '<undefined>';
+ my $default_gateway = $self->get_correct_default_gateway() ||
'<undefined>';
if ($server_request_fixed_ip) {
$computer_public_ip_address = $server_request_fixed_ip;