diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-29 14:07:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-29 14:07:12 -0400 |
commit | 0b808465e21d667c0826f454bbe88abff79389b7 (patch) | |
tree | 4e44a4ad43cee59eca51d90721fc93cbf3d68596 /Assistant/Pairing/MakeRemote.hs | |
parent | 5be6ce672226df37900ddb32f29b24e6b96277a9 (diff) |
Assistant monad, stage 3
All toplevel named threads are converted to the Assistant monad.
Some utility functions still need to be converted.
Diffstat (limited to 'Assistant/Pairing/MakeRemote.hs')
-rw-r--r-- | Assistant/Pairing/MakeRemote.hs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Assistant/Pairing/MakeRemote.hs b/Assistant/Pairing/MakeRemote.hs index ab0bef13c..d7e95686f 100644 --- a/Assistant/Pairing/MakeRemote.hs +++ b/Assistant/Pairing/MakeRemote.hs @@ -8,9 +8,6 @@ module Assistant.Pairing.MakeRemote where import Assistant.Common -import Assistant.ThreadedMonad -import Assistant.DaemonStatus -import Assistant.ScanRemotes import Assistant.Ssh import Assistant.Pairing import Assistant.Pairing.Network @@ -31,13 +28,12 @@ setupAuthorizedKeys msg = do {- When pairing is complete, this is used to set up the remote for the host - we paired with. -} -finishedPairing :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> PairMsg -> SshKeyPair -> IO () -finishedPairing st dstatus scanremotes msg keypair = do - sshdata <- setupSshKeyPair keypair =<< pairMsgToSshData msg - {- Ensure that we know - - the ssh host key for the host we paired with. +finishedPairing :: PairMsg -> SshKeyPair -> Assistant () +finishedPairing msg keypair = do + sshdata <- liftIO $ setupSshKeyPair keypair =<< pairMsgToSshData msg + {- Ensure that we know the ssh host key for the host we paired with. - If we don't, ssh over to get it. -} - unlessM (knownHost $ sshHostName sshdata) $ + liftIO $ unlessM (knownHost $ sshHostName sshdata) $ void $ sshTranscript [ sshOpt "StrictHostKeyChecking" "no" , sshOpt "NumberOfPasswordPrompts" "0" @@ -46,7 +42,10 @@ finishedPairing st dstatus scanremotes msg keypair = do , "git-annex-shell -c configlist " ++ T.unpack (sshDirectory sshdata) ] "" - void $ makeSshRemote st dstatus scanremotes False sshdata + st <- getAssistant threadState + dstatus <- getAssistant daemonStatusHandle + scanremotes <- getAssistant scanRemoteMap + void $ liftIO $ makeSshRemote st dstatus scanremotes False sshdata {- Mostly a straightforward conversion. Except: - * Determine the best hostname to use to contact the host. |