You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2010/10/26 17:11:40 UTC

svn commit: r1027589 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm

Author: arkurth
Date: Tue Oct 26 15:11:40 2010
New Revision: 1027589

URL: http://svn.apache.org/viewvc?rev=1027589&view=rev
Log:
VCL-404
Added "--color=never" argument to ls command that is called in Linux.pm::create_directory() to prevent color code escape sequences from being returned in the output.

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

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1027589&r1=1027588&r2=1027589&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Tue Oct 26 15:11:40 2010
@@ -1486,7 +1486,7 @@ sub create_directory {
 	my $computer_short_name = $self->data->get_computer_short_name();
 	
 	# Attempt to create the directory
-	my $command = "ls -1d \"$directory_path\" 2>&1 || mkdir -p \"$directory_path\" 2>&1 && ls -ld \"$directory_path\"";
+	my $command = "ls -d --color=never \"$directory_path\" 2>&1 || mkdir -p \"$directory_path\" 2>&1 && ls -d --color=never \"$directory_path\"";
 	my ($exit_status, $output) = $self->execute($command);
 	if (!defined($output)) {
 		notify($ERRORS{'WARNING'}, 0, "failed to run command to create directory on $computer_short_name:\npath: '$directory_path'\ncommand: '$command'");
@@ -1496,7 +1496,7 @@ sub create_directory {
 		notify($ERRORS{'WARNING'}, 0, "error occurred attempting to create directory on $computer_short_name: '$directory_path':\ncommand: '$command'\nexit status: $exit_status\noutput:\n" . join("\n", @$output));
 		return;
 	}
-	elsif (grep(/^d.*\s+$directory_path\s*$/, @$output)) {
+	elsif (grep(/^\s*$directory_path\s*$/, @$output)) {
 		if (grep(/ls:/, @$output)) {
 			notify($ERRORS{'OK'}, 0, "directory created on $computer_short_name: '$directory_path'");
 		}
@@ -1506,7 +1506,7 @@ sub create_directory {
 		return 1;
 	}
 	else {
-		notify($ERRORS{'WARNING'}, 0, "unexpected output returned from command to create directory on $computer_short_name: '$directory_path':\ncommand: '$command'\nexit status: $exit_status\noutput:\n" . join("\n", @$output) . "\nlast line:\n" . @$output[-1]);
+		notify($ERRORS{'WARNING'}, 0, "unexpected output returned from command to create directory on $computer_short_name: '$directory_path':\ncommand: '$command'\nexit status: $exit_status\noutput:\n" . join("\n", @$output) . "\nlast line:\n" . string_to_ascii(@$output[-1]));
 		return;
 	}
 }