Fix the user del issue, cgroup tools bug, user creation logic
This commit is contained in:
Родитель
12b95f2258
Коммит
7b6ce1d127
|
@ -136,6 +136,13 @@ namespace hpc
|
|||
"Set correct permissions on key files",
|
||||
}
|
||||
},
|
||||
{ "1.2.1.8",
|
||||
{
|
||||
"Remove the user even if it is logged on",
|
||||
"Won't overwrite the keys if private key is not created",
|
||||
"Work around the bug of removing multi-subsys cgroup in old version of CGroup tools",
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return versionHistory;
|
||||
|
|
|
@ -165,7 +165,7 @@ void* Process::ForkThread(void* arg)
|
|||
}
|
||||
|
||||
Final:
|
||||
p->ExecuteCommand("/bin/bash", "CleanupTask.sh", p->taskExecutionId, p->processId);
|
||||
p->ExecuteCommandNoCapture("/bin/bash", "CleanupTask.sh", p->taskExecutionId, p->processId);
|
||||
p->ExecuteCommand("rm -rf", p->taskFolder);
|
||||
p->ended = true;
|
||||
p->OnCompleted();
|
||||
|
|
|
@ -90,6 +90,18 @@ namespace hpc
|
|||
return ret;
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
int ExecuteCommandNoCapture(const std::string& cmd, const Args& ... args)
|
||||
{
|
||||
std::string output;
|
||||
std::string cmdLine = String::Join(" ", cmd, args...);
|
||||
int ret = System::ExecuteCommandOut(output, cmd, args...);
|
||||
|
||||
Logger::Debug(this->jobId, this->taskId, this->requeueCount, "'{0}', exitCode {1}, output {2}.", cmdLine, ret, output);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void* ForkThread(void*);
|
||||
|
||||
std::string GetAffinity();
|
||||
|
|
|
@ -61,8 +61,9 @@ json::value RemoteExecutor::StartJobAndTask(StartJobAndTaskArgs&& args, const st
|
|||
}
|
||||
|
||||
bool privateKeyAdded = 0 == System::AddSshKey(userName, args.PrivateKey, "id_rsa");
|
||||
bool publicKeyAdded = 0 == System::AddSshKey(userName, args.PublicKey, "id_rsa.pub");
|
||||
bool authKeyAdded = 0 == System::AddAuthorizedKey(userName, args.PublicKey);
|
||||
bool publicKeyAdded = privateKeyAdded && (0 == System::AddSshKey(userName, args.PublicKey, "id_rsa.pub"));
|
||||
|
||||
bool authKeyAdded = privateKeyAdded && publicKeyAdded && (0 == System::AddAuthorizedKey(userName, args.PublicKey));
|
||||
|
||||
if (authKeyAdded)
|
||||
{
|
||||
|
|
|
@ -410,7 +410,7 @@ int System::DeleteUser(const std::string& userName)
|
|||
{
|
||||
std::string output;
|
||||
|
||||
int ret = System::ExecuteCommandOut(output, "userdel", userName, "-r");
|
||||
int ret = System::ExecuteCommandOut(output, "userdel", userName, "-r -f");
|
||||
if (ret != 0)
|
||||
{
|
||||
Logger::Error("userdel {0} error code {1}", userName, ret);
|
||||
|
|
Загрузка…
Ссылка в новой задаче