1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-520 - remove sudo command

This commit is contained in:
david hill
2018-04-12 10:49:09 -05:00
parent c9be90740c
commit 0ea35564f0
17 changed files with 156 additions and 460 deletions

View File

@ -6423,10 +6423,7 @@ void Oam::addUMdisk(const int moduleID, std::string& volumeName, std::string& de
int user;
user = getuid();
if (user == 0)
cmd = "mkfs.ext2 -F " + device + " > /dev/null 2>&1";
else
cmd = "sudo mkfs.ext2 -F " + device + " > /dev/null 2>&1";
cmd = "mkfs.ext2 -F " + device + " > /dev/null 2>&1";
system(cmd.c_str());
@ -6673,10 +6670,7 @@ void Oam::addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist, string
int user;
user = getuid();
if (user == 0)
cmd = "mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
else
cmd = "sudo mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
cmd = "mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
writeLog("addDbroot format cmd: " + cmd, LOG_TYPE_DEBUG );
@ -8660,21 +8654,11 @@ void Oam::syslogAction( std::string action)
}
else
{
int user;
user = getuid();
cmd = "systemctl " + action + " " + systemlog + ".service > /dev/null 2>&1";
system(cmd.c_str());
if (user == 0)
cmd = "systemctl " + action + " " + systemlog + ".service > /dev/null 2>&1";
else
cmd = "sudo systemctl " + action + " " + systemlog + ".service > /dev/null 2>&1";
system(cmd.c_str());
if (user == 0)
cmd = "/service " + systemlog + " " + action + " > /dev/null 2>&1";
else
cmd = "sudo service" + systemlog + " " + action + " > /dev/null 2>&1";
}
cmd = "service " + systemlog + " " + action + " > /dev/null 2>&1";
}
// take action on syslog service
writeLog("syslogAction cmd: " + cmd, LOG_TYPE_DEBUG );
@ -8761,11 +8745,6 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
string glustercmd = "gluster ";
if (user != 0)
{
glustercmd = "sudo " + glustercmd;
}
errmsg = "";
switch ( command )
@ -9022,7 +9001,7 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
if (user != 0)
{
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-uid " + itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
command = "gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-uid " + itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
@ -9031,7 +9010,7 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
exceptionControl("GLUSTER_ADD", API_FAILURE);
}
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-gid " + itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
command = "gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-gid " + itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
@ -9449,10 +9428,7 @@ std::string Oam::updateFstab(std::string device, std::string dbrootID)
string cmd;
if (user == 0)
cmd = "grep /data" + dbrootID + " /etc/fstab > /dev/null 2>&1";
else
cmd = "sudo grep /data" + dbrootID + " /etc/fstab > /dev/null 2>&1";
cmd = "grep /data" + dbrootID + " /etc/fstab > /dev/null 2>&1";
int status = system(cmd.c_str());
@ -9461,18 +9437,12 @@ std::string Oam::updateFstab(std::string device, std::string dbrootID)
//update /etc/fstab with mount
//update local fstab
if (user == 0)
cmd = "echo " + entry + " >> /etc/fstab";
else
cmd = "sudo echo " + entry + " >> /etc/fstab";
cmd = "echo " + entry + " >> /etc/fstab";
system(cmd.c_str());
}
if (user == 0)
cmd = "grep /data" + dbrootID + " " + InstallDir + "/local/etc/pm1/fstab > /dev/null 2>&1";
else
cmd = "sudo grep /data" + dbrootID + " " + InstallDir + "/local/etc/pm1/fstab > /dev/null 2>&1";
cmd = "grep /data" + dbrootID + " " + InstallDir + "/local/etc/pm1/fstab > /dev/null 2>&1";
status = system(cmd.c_str());