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.
This commit is contained in:
parent
af9b0663f2
commit
9a6928d93b
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user