Merge pull request #1440 from NixOS/legacy-ssh-expose-ssh-master

Use new `CommonSSHStoreConfig::createSSHMaster`
This commit is contained in:
John Ericson 2025-02-13 18:30:41 -05:00 committed by GitHub
commit 9ad8ac586c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@
#include "build-result.hh" #include "build-result.hh"
#include "path.hh" #include "path.hh"
#include "legacy-ssh-store.hh"
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "serve-protocol-impl.hh" #include "serve-protocol-impl.hh"
#include "state.hh" #include "state.hh"
@ -403,20 +404,23 @@ void State::buildRemote(ref<Store> destStore,
updateStep(ssConnecting); updateStep(ssConnecting);
auto * pSpecified = std::get_if<StoreReference::Specified>(&machine->storeUri.variant); auto storeRef = machine->completeStoreReference();
auto * pSpecified = std::get_if<StoreReference::Specified>(&storeRef.variant);
if (!pSpecified || pSpecified->scheme != "ssh") { if (!pSpecified || pSpecified->scheme != "ssh") {
throw Error("Currently, only (legacy-)ssh stores are supported!"); throw Error("Currently, only (legacy-)ssh stores are supported!");
} }
SSHMaster master { LegacySSHStoreConfig storeConfig {
pSpecified->scheme,
pSpecified->authority, pSpecified->authority,
machine->sshKey, storeRef.params
machine->sshPublicHostKey,
false, // no SSH master yet
false, // no compression yet
logFD.get(),
}; };
auto master = storeConfig.createSSHMaster(
false, // no SSH master yet
logFD.get());
// FIXME: rewrite to use Store. // FIXME: rewrite to use Store.
auto child = build_remote::openConnection(machine, master); auto child = build_remote::openConnection(machine, master);