queue runner: fix store URI args being written to the SSH hosts file

This commit is contained in:
Pierre Bourdon 2024-07-20 16:09:07 +02:00
parent 9a4a5dd624
commit abc9f11417
Signed by: delroth
GPG key ID: 6FB80DCD84DA0F1C

View file

@ -65,8 +65,8 @@ static void openConnection(::Machine::ptr machine, Path tmpDir, int stderrFD, SS
if (machine->sshKey != "") append(argv, {"-i", machine->sshKey}); if (machine->sshKey != "") append(argv, {"-i", machine->sshKey});
if (machine->sshPublicHostKey != "") { if (machine->sshPublicHostKey != "") {
Path fileName = tmpDir + "/host-key"; Path fileName = tmpDir + "/host-key";
auto p = machine->sshName.find("@"); auto p = sshName.find("@");
std::string host = p != std::string::npos ? std::string(machine->sshName, p + 1) : machine->sshName; std::string host = p != std::string::npos ? std::string(sshName, p + 1) : sshName;
writeFile(fileName, host + " " + machine->sshPublicHostKey + "\n"); writeFile(fileName, host + " " + machine->sshPublicHostKey + "\n");
append(argv, {"-oUserKnownHostsFile=" + fileName}); append(argv, {"-oUserKnownHostsFile=" + fileName});
} }