You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2015/01/26 21:37:40 UTC

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

Author: fapeeler
Date: Mon Jan 26 20:37:40 2015
New Revision: 1654891

URL: http://svn.apache.org/r1654891
Log:
VCL-16

moved code for root access to a seperate routine for create_user 

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

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1654891&r1=1654890&r2=1654891&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Mon Jan 26 20:37:40 2015
@@ -2653,21 +2653,15 @@ sub create_user {
 	}
 
 	# Add user to sudoers if necessary
-	if ($root_access) {
-		my $sudoers_file_path = '/etc/sudoers';
-		my $sudoers_line = "$username ALL= NOPASSWD: ALL\n";
-		if ($self->append_text_file($sudoers_file_path, $sudoers_line)) {
-			notify($ERRORS{'DEBUG'}, 0, "appended line to $sudoers_file_path: '$sudoers_line'");
-		}
-		else {
-			notify($ERRORS{'WARNING'}, 0, "failed to append line to $sudoers_file_path: '$sudoers_line'");
-			return;
-		}
+	if ($self->can("grant_root_access")) {
+		if (!$self->grant_root_access({
+			username => $username,
+			root_access => $root_access,
+			})) {
+			notify($ERRORS{'WARNING'}, 0, "failed to process grant_root_access for $username");
+			}
 	}
-	else {
-		notify($ERRORS{'DEBUG'}, 0, "root access not granted to $username");
-	}
-	
+
 	return 1;
 } ## end sub create_user