From 9a6928d93b54d175268878066d12904a74ee3b20 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 23 May 2024 13:02:34 -0400 Subject: [PATCH] Use new `CommonSSHStoreConfig::createSSHMaster` This avoids some duplicated code, leveraging the same `StoreReference` type that also undergirds the machine file dedup we just did prior. By using `LegacySSHStoreConfig`, we're also taking a baby step towards using the store interface rather than messing around with the protocol internals. --- src/hydra-queue-runner/build-remote.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 5b7b81b7..77bde2c4 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -7,6 +7,7 @@ #include "build-result.hh" #include "path.hh" +#include "legacy-ssh-store.hh" #include "serve-protocol.hh" #include "serve-protocol-impl.hh" #include "state.hh" @@ -403,20 +404,23 @@ void State::buildRemote(ref destStore, updateStep(ssConnecting); - auto * pSpecified = std::get_if(&machine->storeUri.variant); + auto storeRef = machine->completeStoreReference(); + + auto * pSpecified = std::get_if(&storeRef.variant); if (!pSpecified || pSpecified->scheme != "ssh") { throw Error("Currently, only (legacy-)ssh stores are supported!"); } - SSHMaster master { + LegacySSHStoreConfig storeConfig { + pSpecified->scheme, pSpecified->authority, - machine->sshKey, - machine->sshPublicHostKey, - false, // no SSH master yet - false, // no compression yet - logFD.get(), + storeRef.params }; + auto master = storeConfig.createSSHMaster( + false, // no SSH master yet + logFD.get()); + // FIXME: rewrite to use Store. auto child = build_remote::openConnection(machine, master);