Author: arkurth
Date: Mon Mar 30 13:57:24 2009
New Revision: 759971

URL: http://svn.apache.org/viewvc?rev=759971&view=rev
Log:
Removed copy_file(), run_command() and run_remote_script() subs in Windows.pm.  
They were created a while ago as a test and never used.  The run_command() sub 
causes conflicts with utils.pm::run_command().

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

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=759971&r1=759970&r2=759971&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Mon Mar 30 
13:57:24 2009
@@ -68,134 +68,6 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 run_command
-
- Parameters  : String containing the Windows command to be run
- Returns     : Array:
-                  - first index contains the return code of the command
-                  - indices > 0 contain the lines of output generated by 
running
-                    the command
- Description : Runs a command on a Windows node. The command is executed by
-               by passing it through SSH. The command passed to this subroutine
-                                       is formatted so that it runs as a 
Windows command would normally
-               run by using the Windows command shell instead of Cygwin's bash
-               shell.
-
-=cut
-
-sub run_command {
-       my $self = shift;
-       my ($command) = @_;
-
-       # Get the computer node name
-       my $computer_node_name = $self->data->get_computer_node_name();
-
-       # Passing Windows-style commands through SSH/Cygwin causes problems
-       # Encapsulate the command in a 'cmd.exe /q /v:on /k' command and call 
exit afterwards
-       # First replace % with !, the /v:on switch allows this so the variables 
aren't interpolated
-       # /q turns echo off
-       $command =~ s/\%/\!/g;
-
-       # This causes the command to be run in a normal Windows command shell 
rather than Cygwin's bash shell
-       $command = "cmd.exe /q /v:on /c '$command'";
-
-       # Replace line breaks with &&
-       $command =~ s/\n/ && /g;
-
-       # Run the SSH command
-       my @ssh_results = ssh($computer_node_name, $IDENTITY_wxp, $command);
-
-       return @ssh_results;
-} ## end sub run_command
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 run_remote_script
-
- Parameters  :
- Returns     :
- Description :
-
-=cut
-
-sub run_remote_script {
-       my $self = shift;
-       my ($script_path) = @_;
-
-       # Take the script path apart
-       my ($filename, $directory, $extension) = fileparse($script_path, 
qr/\.[^.]*$/);
-
-       # Remove the leading period from the extension
-       $extension =~ s/^\.//;
-
-       # Assemble the remote script path
-       my $remote_script_scp_path = "\$TEMP/$filename.$extension";
-       my $remote_script_ssh_path = "\%TEMP\%\\$filename.$extension";
-
-       # Copy the script to the node
-       if (!$self->copy_file($script_path, $remote_script_scp_path)) {
-               log_warning("failed to execute script, unable to copy 
$script_path to $remote_script_scp_path");
-               return 0;
-       }
-
-       # Assemble a script execution command based on the extension
-       my $command;
-       if ($extension =~ /ws|js|vbs|vbe|wsf|wsh/i) {
-               # Call cscript.exe for vbs and similar files
-               $command = "%SystemRoot%/System32/cscript.exe 
$remote_script_ssh_path //NoLogo";
-       }
-       elsif ($extension !~ /bat|cmd/i) {
-               # Attempt to run other types of files in the Windows command 
interpreter
-               log_warning("unsupported script extension: 
$filename.$extension, attempting to run file in Windows command interpreter");
-               $command = $remote_script_ssh_path;
-       }
-       else {
-               $command = $remote_script_ssh_path;
-       }
-
-       # Attempt to run the script
-       my ($command_exit_status, @command_output) = 
$self->run_command($command);
-       if ($command_exit_status) {
-               log_warning("failed to execute script: $script_path");
-       }
-
-       return ($command_exit_status, @command_output);
-} ## end sub run_remote_script
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 copy_file
-
- Parameters  :
- Returns     :
- Description :
-
-=cut
-
-sub copy_file {
-       my $self = shift;
-       my ($source_file_path, $destination_file_path) = @_;
-
-       # Get the computer node name
-       my $computer_node_name = $self->data->get_computer_node_name();
-
-       my %scp_options = (options          => 'v',
-                                                        identity_file    => 
$IDENTITY_wxp,
-                                                        source_path      => 
$source_file_path,
-                                                        destination_host => 
$computer_node_name,
-                                                        destination_path => 
$destination_file_path,);
-
-       # Run the SCP command
-       if (!scp(\%scp_options)) {
-               log_warning("failed to copy file using SCP");
-               return 0;
-       }
-
-       log_info("file copied using SCP: $source_file_path --> 
$computer_node_name:$destination_file_path");
-       return 1;
-} ## end sub copy_file
-
-#/////////////////////////////////////////////////////////////////////////////
-
 =head2 capture_prepare
 
  Parameters  :


Reply via email to