diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-16 19:06:29 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-16 19:06:29 -0400 |
| commit | 91610aee8f34bb10959bdf6a6e5b16c895c7c1c2 (patch) | |
| tree | 7e493e4b3044de2ce2f3ef2f96dcc5e27d11c19b /src/Propellor/Engine.hs | |
| parent | 2d58a7e8ca2699442d8452c5d3bca8ce43d9e87a (diff) | |
improve ssh user key properties
* Ssh.keyImported is replaced with Ssh.userKeys. (API change)
The new property only gets the private key from the privdata; the
public key is provided as a parameter, and so is available as
Info that other properties can use.
* Ssh.keyImported' is renamed to Ssh.userKeyAt, and also changed
to only import the private key from the privdata. (API change)
* While Ssh.keyImported and Ssh.keyImported' avoided updating existing
keys, the new Ssh.userKeys and Ssh.userKeyAt properties will
always update out of date key files.
* Ssh.pubKey renamed to Ssh.hostPubKey. (API change)
This makes eg, setting up ssh for spin controllers work better.
Diffstat (limited to 'src/Propellor/Engine.hs')
| -rw-r--r-- | src/Propellor/Engine.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs index 87fa4cd2..021ddd2c 100644 --- a/src/Propellor/Engine.hs +++ b/src/Propellor/Engine.hs @@ -7,6 +7,7 @@ module Propellor.Engine ( ensureProperty, ensureProperties, fromHost, + fromHost', onlyProcess, processChainOutput, ) where @@ -76,17 +77,19 @@ ensureProperties ps = ensure ps NoChange r <- actionMessageOn hn (propertyDesc p) (ensureProperty p) ensure ls (r <> rs) --- | Lifts an action into a different host. +-- | Lifts an action into the context of a different host. -- --- > fromHost hosts "otherhost" getPubKey +-- > fromHost hosts "otherhost" Ssh.getHostPubKey fromHost :: [Host] -> HostName -> Propellor a -> Propellor (Maybe a) fromHost l hn getter = case findHost l hn of Nothing -> return Nothing - Just h -> do - (ret, _s, runlog) <- liftIO $ - runRWST (runWithHost getter) h () - tell runlog - return (Just ret) + Just h -> Just <$> fromHost' h getter + +fromHost' :: Host -> Propellor a -> Propellor a +fromHost' h getter = do + (ret, _s, runlog) <- liftIO $ runRWST (runWithHost getter) h () + tell runlog + return ret onlyProcess :: FilePath -> IO a -> IO a onlyProcess lockfile a = bracket lock unlock (const a) |
