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 2009/09/30 22:37:06 UTC

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

Author: fapeeler
Date: Wed Sep 30 20:37:05 2009
New Revision: 820436

URL: http://svn.apache.org/viewvc?rev=820436&view=rev
Log:
VCL-185

useradd fails if the user_name group exists
added groupdel <username> to delete_user routine



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=820436&r1=820435&r2=820436&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Wed Sep 30 20:37:05 2009
@@ -548,6 +548,12 @@
 		}
 	}
 
+	# Delete the group
+	my $user_group_cmd = "/usr/sbin/groupdel $user_login_id";
+	if(run_ssh_command($computer_node_name, $image_identity, $user_delete_command, "root")){
+		notify($ERRORS{'DEBUG'}, 0, "attempted to delete usergroup for $user_login_id");
+	}
+
 	my $imagemeta_rootaccess = $self->data->get_imagemeta_rootaccess();
 
 	#Clear user from external_sshd_config
@@ -607,9 +613,11 @@
 
 	my @sshcmd = run_ssh_command($computer_node_name, $image_identity, $useradd_string, "root");
 	foreach my $l (@{$sshcmd[1]}) {
-		if ($l =~ /user $user_name exists/) {
+		if ($l =~ /$user_name exists/) {
 			notify($ERRORS{'OK'}, 0, "detected user already has account");
-
+			if ($self->delete_user()) {
+				notify($ERRORS{'OK'}, 0, "user has been deleted from $computer_node_name");
+			}
 		}
 	}