Author: arkurth
Date: Fri Sep 17 19:28:59 2010
New Revision: 998278
URL: http://svn.apache.org/viewvc?rev=998278&view=rev
Log:
VCL-196
Updated commands in the Windows modules that call cmd.exe to not use Sysnative
within the cmd.exe argument because it is not available once within the 64-bit
cmd.exe shell.
Other
Updated utils.pm::format_data to add a : to the beginning of each line returned
by Dumper. This causes the output to be indented in the log file. Otherwise,
leading spaces are stripped off.
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
incubator/vcl/trunk/managementnode/lib/VCL/utils.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=998278&r1=998277&r2=998278&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Fri Sep 17
19:28:59 2010
@@ -3288,22 +3288,21 @@ sub shutdown {
return;
}
- $shutdown_command .= "$system32_path/netsh.exe interface ip set
address name=\\\"$private_interface_name\\\" source=dhcp & ";
- $shutdown_command .= "$system32_path/netsh.exe interface ip set
dnsservers name=\\\"$private_interface_name\\\" source=dhcp & ";
-
- $shutdown_command .= "$system32_path/netsh.exe interface ip set
address name=\\\"$public_interface_name\\\" source=dhcp & ";
- $shutdown_command .= "$system32_path/netsh.exe interface ip set
dnsservers name=\\\"$public_interface_name\\\" source=dhcp & ";
-
- $shutdown_command .= "$system32_path/ipconfig.exe /release & ";
-
- $shutdown_command .= "$system32_path/route.exe DELETE 0.0.0.0
MASK 0.0.0.0 & ";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/netsh.exe
interface ip set address name=\\\"$private_interface_name\\\" source=dhcp & ";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/netsh.exe
interface ip set dnsservers name=\\\"$private_interface_name\\\" source=dhcp &
";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/netsh.exe
interface ip set address name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/netsh.exe
interface ip set dnsservers name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/ipconfig.exe
/release & ";
+ $shutdown_command .= "\%SYSTEMROOT\%/System32/route.exe DELETE
0.0.0.0 MASK 0.0.0.0 & ";
}
else {
notify($ERRORS{'DEBUG'}, 0, "shutting down
$computer_node_name");
}
# Initiate the shutdown.exe command to reboot the computer
- $shutdown_command .= "$system32_path/shutdown.exe -s -t 0 -f\"";
+ $shutdown_command .= "start \%SYSTEMROOT\%/System32/shutdown.exe -s -t
0 -f";
+
+ $shutdown_command .= "\"";
my $attempt_count = 0;
my $attempt_limit = 12;
@@ -5864,7 +5863,7 @@ sub run_gpupdate {
my $computer_node_name = $self->data->get_computer_node_name();
my $system32_path = $self->get_system32_path() || return;
- my $gpupdate_command = "$system32_path/cmd.exe /c
$system32_path/gpupdate.exe /Force";
+ my $gpupdate_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/gpupdate.exe /Force";
my ($gpupdate_status, $gpupdate_output) =
run_ssh_command($computer_node_name, $management_node_keys, $gpupdate_command);
if (defined($gpupdate_output) && !grep(/error/i, @{$gpupdate_output})) {
notify($ERRORS{'OK'}, 0, "ran gpupdate /force");
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm?rev=998278&r1=998277&r2=998278&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
Fri Sep 17 19:28:59 2010
@@ -279,20 +279,20 @@ sub run_sysprep {
}
# Release any DHCP addresses and delete the default route
- $sysprep_command .= "$system32_path/ipconfig.exe /release & ";
- $sysprep_command .= "$system32_path/route.exe DELETE 0.0.0.0 MASK
0.0.0.0 & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/ipconfig.exe /release & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/route.exe DELETE 0.0.0.0
MASK 0.0.0.0 & ";
# Disable DHCP
- $sysprep_command .= "$system32_path/netsh.exe interface ip set address
name=\\\"$private_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set dns
name=\\\"$private_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set address
name=\\\"$public_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set dns
name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
address name=\\\"$private_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
dns name=\\\"$private_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
address name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
dns name=\\\"$public_interface_name\\\" source=dhcp & ";
# Run Sysprep.exe
$sysprep_command .= "C:/Sysprep/sysprep.exe /quiet /reseal /mini
/forceshutdown & ";
# Shutdown the computer - Sysprep does not always shut the computer
down automatically
- $sysprep_command .= "$system32_path/shutdown.exe -s -t 0 -f";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/shutdown.exe -s -t 0 -f";
$sysprep_command .= "\"";
my ($sysprep_status, $sysprep_output) =
run_ssh_command($computer_node_name, $management_node_keys, $sysprep_command);
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm?rev=998278&r1=998277&r2=998278&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
Fri Sep 17 19:28:59 2010
@@ -496,7 +496,7 @@ sub run_slmgr_ipk {
}
# Run cscript.exe slmgr.vbs -ipk to install the product key
- my $ipk_command = "$system32_path/cmd.exe /c $system32_path/cscript.exe
//NoLogo $system32_path/slmgr.vbs -ipk $product_key";
+ my $ipk_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-ipk $product_key";
my ($ipk_exit_status, $ipk_output) =
run_ssh_command($computer_node_name, $management_node_keys, $ipk_command);
if (defined($ipk_exit_status) && $ipk_exit_status == 0 &&
grep(/successfully/i, @$ipk_output)) {
notify($ERRORS{'OK'}, 0, "installed product key: $product_key");
@@ -537,7 +537,7 @@ sub run_slmgr_ckms {
# Run slmgr.vbs -ckms to clear an existing KMS server from a computer
# slmgr.vbs must be run in a command shell using the correct System32
path or the task it's supposed to do won't really take effect
- my $skms_command = "$system32_path/cmd.exe /c
$system32_path/cscript.exe //NoLogo $system32_path/slmgr.vbs -ckms";
+ my $skms_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-ckms";
my ($skms_exit_status, $skms_output) =
run_ssh_command($computer_node_name, $management_node_keys, $skms_command);
if (defined($skms_exit_status) && $skms_exit_status == 0 &&
grep(/successfully/i, @$skms_output)) {
notify($ERRORS{'OK'}, 0, "cleared kms server");
@@ -578,7 +578,7 @@ sub run_slmgr_cpky {
# Run slmgr.vbs -cpky to clear an existing product key from a computer
# slmgr.vbs must be run in a command shell using the correct System32
path or the task it's supposed to do won't really take effect
- my $skms_command = "$system32_path/cmd.exe /c
$system32_path/cscript.exe //NoLogo $system32_path/slmgr.vbs -cpky";
+ my $skms_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-cpky";
my ($skms_exit_status, $skms_output) =
run_ssh_command($computer_node_name, $management_node_keys, $skms_command);
if (defined($skms_exit_status) && $skms_exit_status == 0 &&
grep(/successfully/i, @$skms_output)) {
notify($ERRORS{'OK'}, 0, "cleared product key");
@@ -629,7 +629,7 @@ sub run_slmgr_skms {
# Run slmgr.vbs -skms to configure the computer to use the KMS server
# slmgr.vbs must be run in a command shell using the correct System32
path or the task it's supposed to do won't really take effect
- my $skms_command = "$system32_path/cmd.exe /c
$system32_path/cscript.exe //NoLogo $system32_path/slmgr.vbs -skms
$kms_address:$kms_port";
+ my $skms_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-skms $kms_address:$kms_port";
my ($skms_exit_status, $skms_output) =
run_ssh_command($computer_node_name, $management_node_keys, $skms_command);
if (defined($skms_exit_status) && $skms_exit_status == 0 &&
grep(/successfully/i, @$skms_output)) {
notify($ERRORS{'OK'}, 0, "set kms server to
$kms_address:$kms_port");
@@ -669,7 +669,7 @@ sub run_slmgr_ato {
my $system32_path = $self->get_system32_path() || return;
# Run cscript.exe slmgr.vbs -ato to install the product key
- my $ato_command = "$system32_path/cmd.exe /c $system32_path/cscript.exe
//NoLogo $system32_path/slmgr.vbs -ato";
+ my $ato_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-ato";
my ($ato_exit_status, $ato_output) =
run_ssh_command($computer_node_name, $management_node_keys, $ato_command);
if (defined($ato_exit_status) && $ato_exit_status == 0 &&
grep(/successfully/i, @$ato_output)) {
notify($ERRORS{'OK'}, 0, "activated license");
@@ -709,7 +709,7 @@ sub run_slmgr_dlv {
my $system32_path = $self->get_system32_path() || return;
# Run cscript.exe slmgr.vbs -dlv to install the product key
- my $dlv_command = "$system32_path/cmd.exe /c $system32_path/cscript.exe
//NoLogo $system32_path/slmgr.vbs -dlv";
+ my $dlv_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-dlv";
my ($dlv_exit_status, $dlv_output) =
run_ssh_command($computer_node_name, $management_node_keys, $dlv_command, '',
'', 0);
if (defined($dlv_exit_status) && $dlv_exit_status == 0) {
notify($ERRORS{'OK'}, 0, "licensing information:\n" .
join("\n", @$dlv_output));
@@ -750,7 +750,7 @@ sub get_license_status {
my $system32_path = $self->get_system32_path() || return;
# Run cscript.exe slmgr.vbs -dlv to get the activation status
- my $dlv_command = "$system32_path/cmd.exe /c $system32_path/cscript.exe
//NoLogo $system32_path/slmgr.vbs -dlv";
+ my $dlv_command = "$system32_path/cmd.exe /c
\%SYSTEMROOT\%/System32/cscript.exe //NoLogo \%SYSTEMROOT\%/System32/slmgr.vbs
-dlv";
my ($dlv_exit_status, $dlv_output) =
run_ssh_command($computer_node_name, $management_node_keys, $dlv_command, '',
'', 0);
if ($dlv_output && grep(/License Status/i, @$dlv_output)) {
#notify($ERRORS{'DEBUG'}, 0, "retrieved license information");
@@ -1600,17 +1600,17 @@ EOF
}
# Release any DHCP addresses and delete the default route
- $sysprep_command .= "$system32_path/ipconfig.exe /release & ";
- $sysprep_command .= "$system32_path/route.exe DELETE 0.0.0.0 MASK
0.0.0.0 & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/ipconfig.exe /release & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/route.exe DELETE 0.0.0.0
MASK 0.0.0.0 & ";
# Disable DHCP
- $sysprep_command .= "$system32_path/netsh.exe interface ip set address
name=\\\"$private_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set dns
name=\\\"$private_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set address
name=\\\"$public_interface_name\\\" source=dhcp & ";
- $sysprep_command .= "$system32_path/netsh.exe interface ip set dns
name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
address name=\\\"$private_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
dns name=\\\"$private_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
address name=\\\"$public_interface_name\\\" source=dhcp & ";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/netsh.exe interface ip set
dns name=\\\"$public_interface_name\\\" source=dhcp & ";
# Run Sysprep.exe
- $sysprep_command .= "$system32_path/sysprep/sysprep.exe /generalize
/oobe /shutdown /quiet /unattend:$system32_path/sysprep/Unattend.xml";
+ $sysprep_command .= "\%SYSTEMROOT\%/System32/sysprep/sysprep.exe
/generalize /oobe /shutdown /quiet
/unattend:$system32_path/sysprep/Unattend.xml";
$sysprep_command .= "\"";
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=998278&r1=998277&r2=998278&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Fri Sep 17 19:28:59 2010
@@ -5402,6 +5402,13 @@ sub run_ssh_command {
#notify($ERRORS{'DEBUG'}, 0, "ssh path: $ssh_path");
#notify($ERRORS{'DEBUG'}, 0, "node: $node, identity file paths:
$identity_paths, user: $user, port: $port");
#notify($ERRORS{'DEBUG'}, 0, "command: $command");
+
+ #if ($command =~ /['\\]/) {
+ # my @octals = map { "0" . sprintf("%o", $_) } unpack("C*",
$command);
+ # my $octal_string = '\\' . join("\\", @octals);
+ # $command = "echo -e \"$octal_string\" | \$SHELL";
+ # notify($ERRORS{'DEBUG'}, 0, "octal command:\n$command");
+ #}
# Assemble the SSH command
# -i <identity_file>, Selects the file from which the identity (private
key) for RSA authentication is read.
@@ -8658,7 +8665,13 @@ sub format_data {
$Data::Dumper::Pair = ' => '; # Specifies the separator between
hash keys and values
$Data::Dumper::Sortkeys = 1; # Hash keys are dumped in sorted
order
- return Dumper(@data);
+ my $formatted_string = Dumper(@data);
+
+ my @formatted_lines = split("\n", $formatted_string);
+
+ map { $_ = ": $_" } @formatted_lines;
+
+ return join("\n", @formatted_lines);
}
#/////////////////////////////////////////////////////////////////////////////