From 65f6a2b11f37d4f621c9e619ccd6567a95c31674 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 9 Jan 2013 18:18:56 +0000 Subject: [PATCH] add sudo support in xdsh and updatenode git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14830 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/updatenode.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 34fe28ee2..19afd2937 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1205,15 +1205,25 @@ sub updatenoderunps $runpscmd = "$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4" } - - $args1 = [ + # if non-root userid ask xdsh to use sudo + if (defined($::USER)){ # non-root user + $args1 = [ + "--nodestatus", + "--sudo", + "-s", + "-v", + "-e", + "$runpscmd" + ]; + } else { # running as root + $args1 = [ "--nodestatus", "-s", "-v", "-e", "$runpscmd" - ]; - + ]; + } # if -l username input if (defined($::USER)){ # need to add the -l username unshift(@$args1, "$::USER");