diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/EnsureProperty.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/List.hs | 9 | ||||
| -rw-r--r-- | src/Propellor/Property/Tor.hs | 14 | ||||
| -rw-r--r-- | src/Propellor/Types.hs | 2 |
4 files changed, 22 insertions, 5 deletions
diff --git a/src/Propellor/EnsureProperty.hs b/src/Propellor/EnsureProperty.hs index badc7293..ad74bfa8 100644 --- a/src/Propellor/EnsureProperty.hs +++ b/src/Propellor/EnsureProperty.hs @@ -46,7 +46,7 @@ ensureProperty => OuterMetaTypesWitness outer -> Property (MetaTypes inner) -> Propellor Result -ensureProperty _ = maybe (pure NoChange) catchPropellor . getSatisfy +ensureProperty _ = maybe (return NoChange) catchPropellor . getSatisfy -- The name of this was chosen to make type errors a bit more understandable. type family Cannot_ensureProperty_WithInfo (l :: [a]) :: Bool diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs index 11d201b1..758e51ce 100644 --- a/src/Propellor/Property/List.hs +++ b/src/Propellor/Property/List.hs @@ -43,6 +43,13 @@ propertyList desc (Props ps) = -- | Combines a list of properties, resulting in one property that -- ensures each in turn. Stops if a property fails. +-- +-- > combineProperties "foo" $ props +-- > & bar +-- > & baz +-- +-- This is similar to using `mconcat` with a list of properties, +-- except it can combine together different types of properties. combineProperties :: SingI metatypes => Desc -> Props (MetaTypes metatypes) -> Property (MetaTypes metatypes) combineProperties desc (Props ps) = property desc (combineSatisfy cs NoChange) @@ -53,7 +60,7 @@ combineProperties desc (Props ps) = combineSatisfy :: [ChildProperty] -> Result -> Propellor Result combineSatisfy [] rs = return rs combineSatisfy (p:ps) rs = do - r <- maybe (pure NoChange) catchPropellor (getSatisfy p) + r <- maybe (return NoChange) catchPropellor (getSatisfy p) case r of FailedChange -> return FailedChange _ -> combineSatisfy ps (r <> rs) diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index 24d5b687..8794bc7f 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -53,12 +53,20 @@ named n = configured [("Nickname", n')] where n' = saneNickname n +-- | Configures tor with secret_id_key, ed25519_master_id_public_key, +-- and ed25519_master_id_secret_key from privdata. torPrivKey :: Context -> Property (HasInfo + DebianLike) -torPrivKey context = f `File.hasPrivContent` context - `onChange` File.ownerGroup f user (userGroup user) +torPrivKey context = mconcat (map go keyfiles) + `onChange` restarted `requires` torPrivKeyDirExists where - f = torPrivKeyDir </> "secret_id_key" + keyfiles = map (torPrivKeyDir </>) + [ "secret_id_key" + , "ed25519_master_id_public_key" + , "ed25519_master_id_secret_key" + ] + go f = f `File.hasPrivContent` context + `onChange` File.ownerGroup f user (userGroup user) torPrivKeyDirExists :: Property DebianLike torPrivKeyDirExists = File.dirExists torPrivKeyDir diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs index 690c153a..155662c2 100644 --- a/src/Propellor/Types.hs +++ b/src/Propellor/Types.hs @@ -44,6 +44,8 @@ module Propellor.Types ( ) where import Data.Monoid +import Control.Applicative +import Prelude import Propellor.Types.Core import Propellor.Types.Info |
