Author: arkurth
Date: Tue May  5 18:47:15 2009
New Revision: 771961

URL: http://svn.apache.org/viewvc?rev=771961&view=rev
Log:
VCL-125
Windows_mod.pm::create_user() - Improved the "if" statement logic where the 
value retrieved from imagemeta.rootaccess is checked. If the value was 
undefined because the database didn't contain the column, a warning message 
would appear in the log output. It was working correctly but the new logic 
prevents the warning message from appearing.

utils.pm::get_imagemeta_info() - Added line to set the rootaccess key in the 
hash being returned to 1 if it isn't defined in the database. This helps ensure 
the default is always to grant rootaccess unless explicitly configured to not 
grant root access.

Other
Windows_mod.pm::create_user() - Fixed bug where it was calling an invalid 
subroutine name get_user_password() from DataStructure.pm. It should be 
get_reservation_password().

Windows_mod.pm::user_exists() - Changed run_ssh_command() to not display 
output. It was causing a large section of user into to appear in the log file.

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

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm?rev=771961&r1=771960&r2=771961&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm Tue May 
 5 18:47:15 2009
@@ -1143,7 +1143,7 @@
 
        # Attempt to query the user account
        my $query_user_command = "net user \"$username\"";
-       my ($query_user_exit_status, $query_user_output) = 
run_ssh_command($computer_node_name, $management_node_keys, 
$query_user_command);
+       my ($query_user_exit_status, $query_user_output) = 
run_ssh_command($computer_node_name, $management_node_keys, 
$query_user_command, '', '', '1');
        if (defined($query_user_exit_status) && $query_user_exit_status == 0) {
                notify($ERRORS{'DEBUG'}, 0, "user $username exists on 
$computer_node_name");
                return 1;
@@ -1191,7 +1191,7 @@
                $username = $self->data->get_user_login_id();
        }
        if (!$password) {
-               $password = $self->data->get_user_password();
+               $password = $self->data->get_reservation_password();
        }
 
        # Check if user already exists
@@ -1208,15 +1208,19 @@
        notify($ERRORS{'DEBUG'}, 0, "attempting to add user $username to 
$computer_node_name ($password)");
 
        # Attempt to add the user account
-       my $add_user_command = "net user \"$username\" \"$password\" /ADD  
/EXPIRES:NEVER /COMMENT:\"Account created by VCL\"";
+       my $add_user_command = "net user \"$username\" \"$password\" /ADD 
/EXPIRES:NEVER /COMMENT:\"Account created by VCL\"";
        $add_user_command .= " && net localgroup \"Remote Desktop Users\" 
\"$username\" /ADD";
        
-       # Add the user to the Administrators group if imagemeta.rootaccess is 1
-       if ($imagemeta_rootaccess != 0) {
+       # Add the user to the Administrators group if imagemeta.rootaccess 
isn't 0
+       if (defined($imagemeta_rootaccess) && $imagemeta_rootaccess eq '0') {
+               notify($ERRORS{'DEBUG'}, 0, "user will NOT be added to the 
Administrators group");
+       }
+       else {
+               notify($ERRORS{'DEBUG'}, 0, "user will be added to the 
Administrators group");
                $add_user_command .= " && net localgroup \"Administrators\" 
\"$username\" /ADD";
        }
 
-       my ($add_user_exit_status, $add_user_output) = 
run_ssh_command($computer_node_name, $management_node_keys, $add_user_command);
+       my ($add_user_exit_status, $add_user_output) = 
run_ssh_command($computer_node_name, $management_node_keys, $add_user_command, 
'', '', '1');
        if (defined($add_user_exit_status) && $add_user_exit_status == 0) {
                notify($ERRORS{'OK'}, 0, "added user $username ($password) to 
$computer_node_name");
        }

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=771961&r1=771960&r2=771961&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Tue May  5 18:47:15 2009
@@ -6507,6 +6507,7 @@
        $imagemeta{usergroupid}  = 0 if !defined($imagemeta{usergroupid});
        $imagemeta{postoption}   = 0 if !defined($imagemeta{postoption});
        $imagemeta{architecture} = 0 if !defined($imagemeta{architecture});
+       $imagemeta{rootaccess} = 1 if !defined($imagemeta{rootaccess});
 
        # Populate the count of user group members
        $imagemeta{USERGROUPMEMBERCOUNT} = 
scalar(keys(%{$imagemeta{USERGROUPMEMBERS}}));


Reply via email to