Author: arkurth
Date: Wed Nov 28 15:46:02 2012
New Revision: 1414765

URL: http://svn.apache.org/viewvc?rev=1414765&view=rev
Log:
VCL-582
Fixed problem in Upstart.pm::delete_service. Previous versions of the Ubuntu 
code were configuring a service named ext_sshd. The new code calls it ext_ssh 
to match the regular ssh service name. The delete_service subroutine wasn't 
attempting to delete both names. As a result, images loaded with older code 
having a service named ext_sshd failed. Updated code to attempt to delete both 
service names.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/Upstart.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/Upstart.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/Upstart.pm?rev=1414765&r1=1414764&r2=1414765&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/Upstart.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/Upstart.pm Wed Nov 28 
15:46:02 2012
@@ -164,22 +164,32 @@ sub delete_service {
                return;
        }
        
-       my $service_name = shift;
-       if (!$service_name) {
+       my $service_name_argument = shift;
+       if (!$service_name_argument) {
                notify($ERRORS{'WARNING'}, 0, "service name argument was not 
supplied");
                return;
        }
-       $service_name = $SERVICE_NAME_MAPPINGS->{$service_name} || 
$service_name;
        
-       my $computer_node_name = $self->data->get_computer_node_name();
+       # Need to attempt to delete both the service with a name matching the 
argument as well as the mapped service name
+       my @service_names = ($service_name_argument);
        
-       $self->stop_service($service_name) || return;
+       # If a mapped service name also exists, attempt to delete it as well
+       if ($SERVICE_NAME_MAPPINGS->{$service_name_argument}) {
+               push @service_names, 
$SERVICE_NAME_MAPPINGS->{$service_name_argument};
+       }
        
-       # Delete the service configuration file
-       my $service_file_path = "/etc/init/$service_name.conf";
-       $self->delete_file($service_file_path) || return;
+       my $computer_node_name = $self->data->get_computer_node_name();
+       
+       for my $service_name (@service_names) {
+               $self->stop_service($service_name) || return;
+               
+               # Delete the service configuration file
+               my $service_file_path = "/etc/init/$service_name.conf";
+               $self->delete_file($service_file_path) || return;
+               
+               notify($ERRORS{'DEBUG'}, 0, "deleted '$service_name' service on 
$computer_node_name");
+       }
        
-       notify($ERRORS{'DEBUG'}, 0, "deleted '$service_name' service on 
$computer_node_name");
        return 1;
 }
 
@@ -270,7 +280,7 @@ sub stop_service {
        }
        elsif (grep(/Unknown job/i, @$output)) {
                # Output if the service doesn't exist: 'initctl: Unknown job: 
<service name>'
-               notify($ERRORS{'WARNING'}, 0, "'$service_name' service does not 
exist on $computer_node_name");
+               notify($ERRORS{'DEBUG'}, 0, "'$service_name' service does not 
exist on $computer_node_name");
                return 1;
        }
        elsif (grep(/Unknown instance/i, @$output)) {


Reply via email to