summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2016-03-25 16:20:32 -0400
committerJoey Hess2016-03-25 16:20:32 -0400
commitf01776d64b1b8fcf89903d0de1ffe27f10d620ee (patch)
treecb7ef68ab23aa43e8a7ed7b428ef57f0b356921f /src
parent6b9f3158df63e18b32b7175205ef686badc3bc1b (diff)
rename toProp to toChildProperties
and note that it's not meant to be used by regular users
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Engine.hs2
-rw-r--r--src/Propellor/PropAccum.hs6
-rw-r--r--src/Propellor/Property/Chroot.hs7
-rw-r--r--src/Propellor/Property/Docker.hs4
-rw-r--r--src/Propellor/Property/List.hs6
-rw-r--r--src/Propellor/Types.hs23
6 files changed, 17 insertions, 31 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index bf49b95f..4c37e704 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -33,7 +33,7 @@ import Utility.Exception
-- with nice display of what's being done.
mainProperties :: Host -> IO ()
mainProperties host = do
- ret <- runPropellor host $ ensureChildProperties [toProp overall]
+ ret <- runPropellor host $ ensureChildProperties [toChildProperty overall]
messagesDone
case ret of
FailedChange -> exitWith (ExitFailure 1)
diff --git a/src/Propellor/PropAccum.hs b/src/Propellor/PropAccum.hs
index 06b8ad3f..7547a81d 100644
--- a/src/Propellor/PropAccum.hs
+++ b/src/Propellor/PropAccum.hs
@@ -62,7 +62,7 @@ type instance GetMetaTypes (RevertableProperty (MetaTypes t) undo) = MetaTypes t
=> Props (MetaTypes x)
-> p
-> Props (MetaTypes (Combine x y))
-Props c & p = Props (c ++ [toProp p])
+Props c & p = Props (c ++ [toChildProperty p])
-- | Adds a property before any other properties.
(&^)
@@ -74,7 +74,7 @@ Props c & p = Props (c ++ [toProp p])
=> Props (MetaTypes x)
-> p
-> Props (MetaTypes (Combine x y))
-Props c &^ p = Props (toProp p : c)
+Props c &^ p = Props (toChildProperty p : c)
-- | Adds a property in reverted form.
(!)
@@ -82,7 +82,7 @@ Props c &^ p = Props (toProp p : c)
=> Props (MetaTypes x)
-> RevertableProperty (MetaTypes y) (MetaTypes z)
-> Props (MetaTypes (Combine x z))
-Props c ! p = Props (c ++ [toProp (revert p)])
+Props c ! p = Props (c ++ [toChildProperty (revert p)])
{-
diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs
index fb05d659..bf6f2083 100644
--- a/src/Propellor/Property/Chroot.hs
+++ b/src/Propellor/Property/Chroot.hs
@@ -213,11 +213,10 @@ chain hostlist (ChrootChain hn loc systemdonly onconsole) =
changeWorkingDirectory localdir
when onconsole forceConsole
onlyProcess (provisioningLock loc) $ do
- r <- runPropellor (setInChroot h) $ ensureProperties $
+ r <- runPropellor (setInChroot h) $ ensureChildProperties $
if systemdonly
- then [Systemd.installed]
- else map ignoreInfo $
- hostProperties h
+ then [toProp Systemd.installed]
+ else hostProperties h
flushConcurrentOutput
putStrLn $ "\n" ++ show r
chain _ _ = errorMessage "bad chain command"
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 4bbfeef3..d19d15aa 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -581,9 +581,7 @@ chain hostlist hn s = case toContainerId s of
go cid h = do
changeWorkingDirectory localdir
onlyProcess (provisioningLock cid) $ do
- r <- runPropellor h $ ensureChildProperties $
- map ignoreInfo $
- hostProperties h
+ r <- runPropellor h $ ensureChildProperties $ hostProperties h
flushConcurrentOutput
putStrLn $ "\n" ++ show r
diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs
index 44916f23..d8c5cff4 100644
--- a/src/Propellor/Property/List.hs
+++ b/src/Propellor/Property/List.hs
@@ -21,7 +21,7 @@ import Propellor.Exception
import Data.Monoid
toProps :: [Property (MetaTypes metatypes)] -> Props (MetaTypes metatypes)
-toProps ps = Props (map toProp ps)
+toProps ps = Props (map toChildProperty ps)
-- | Combines a list of properties, resulting in a single property
-- that when run will run each property in the list in turn,
@@ -38,7 +38,7 @@ propertyList desc (Props ps) =
property desc (ensureChildProperties cs)
`modifyChildren` (++ cs)
where
- cs = map toProp ps
+ cs = map toChildProperty ps
-- | Combines a list of properties, resulting in one property that
-- ensures each in turn. Stops if a property fails.
@@ -47,7 +47,7 @@ combineProperties desc (Props ps) =
property desc (combineSatisfy cs NoChange)
`modifyChildren` (++ cs)
where
- cs = map toProp ps
+ cs = map toChildProperty ps
combineSatisfy :: [ChildProperty] -> Result -> Propellor Result
combineSatisfy [] rs = return rs
diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs
index dd8721ac..f42f55d7 100644
--- a/src/Propellor/Types.hs
+++ b/src/Propellor/Types.hs
@@ -158,18 +158,6 @@ addInfoProperty
addInfoProperty (Property _ d a oldi c) newi =
Property sing d a (oldi <> newi) c
-{-
-
--- | Makes a version of a Proprty without its Info.
--- Use with caution!
-ignoreInfo
- :: (metatypes' ~
- => Property metatypes
- -> Property (MetaTypes metatypes')
-ignoreInfo =
-
--}
-
-- | Changes the action that is performed to satisfy a property.
adjustPropertySatisfy :: Property metatypes -> (Propellor Result -> Propellor Result) -> Property metatypes
adjustPropertySatisfy (Property t d s i c) f = Property t d (f s) i c
@@ -213,7 +201,9 @@ class IsProp p where
-- | Gets the info of the property, combined with all info
-- of all children properties.
getInfoRecursive :: p -> Info
- toProp :: p -> ChildProperty
+ -- | Gets a ChildProperty representing the Property.
+ -- You should not normally need to use this.
+ toChildProperty :: p -> ChildProperty
-- | Gets the action that can be run to satisfy a Property.
-- You should never run this action directly. Use
-- 'Propellor.EnsureProperty.ensureProperty` instead.
@@ -225,7 +215,7 @@ instance IsProp (Property metatypes) where
modifyChildren (Property t d a i c) f = Property t d a i (f c)
getInfoRecursive (Property _ _ _ i c) =
i <> mconcat (map getInfoRecursive c)
- toProp (Property _ d a i c) = ChildProperty d a i c
+ toChildProperty (Property _ d a i c) = ChildProperty d a i c
getSatisfy (Property _ _ a _ _) = a
instance IsProp ChildProperty where
@@ -234,7 +224,7 @@ instance IsProp ChildProperty where
modifyChildren (ChildProperty d a i c) f = ChildProperty d a i (f c)
getInfoRecursive (ChildProperty _ _ i c) =
i <> mconcat (map getInfoRecursive c)
- toProp = id
+ toChildProperty = id
getSatisfy (ChildProperty _ a _ _) = a
instance IsProp (RevertableProperty setupmetatypes undometatypes) where
@@ -243,10 +233,9 @@ instance IsProp (RevertableProperty setupmetatypes undometatypes) where
RevertableProperty (setDesc p1 d) (setDesc p2 ("not " ++ d))
getDesc (RevertableProperty p1 _) = getDesc p1
modifyChildren (RevertableProperty p1 p2) f = RevertableProperty (modifyChildren p1 f) (modifyChildren p2 f)
- -- toProp (RevertableProperty p1 _) = p1
-- | Return the Info of the currently active side.
getInfoRecursive (RevertableProperty p1 _p2) = getInfoRecursive p1
- toProp (RevertableProperty p1 _p2) = toProp p1
+ toChildProperty (RevertableProperty p1 _p2) = toChildProperty p1
getSatisfy (RevertableProperty p1 _) = getSatisfy p1
-- | Type level calculation of the type that results from combining two