From 7d4d3e44518aef38e7c036e76dfaf8e6f1c21bdb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Nov 2014 14:11:02 -0400 Subject: fix info propigation Need to propigate the full container info, not the subset used in chroot deployment. --- src/Propellor/Property/Chroot.hs | 9 +++++++-- src/Propellor/Property/Systemd.hs | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index e7bac84a..7fee3a59 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -3,6 +3,8 @@ module Propellor.Property.Chroot ( chroot, provisioned, -- * Internal use + provisioned', + propigateChrootInfo, propellChroot, chain, ) where @@ -38,8 +40,11 @@ chroot location system = Chroot location system (Host location [] mempty) -- Reverting this property removes the chroot. Note that it does not ensure -- that any processes that might be running inside the chroot are stopped. provisioned :: Chroot -> RevertableProperty -provisioned c@(Chroot loc system _) = RevertableProperty - (propigateChrootInfo c (go "exists" setup)) +provisioned c = provisioned' (propigateChrootInfo c) c + +provisioned' :: (Property -> Property) -> Chroot -> RevertableProperty +provisioned' propigator c@(Chroot loc system _) = RevertableProperty + (propigator $ go "exists" setup) (go "removed" teardown) where go desc a = property (chrootDesc c desc) $ ensureProperties [a] diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs index 862b674b..9b0a445d 100644 --- a/src/Propellor/Property/Systemd.hs +++ b/src/Propellor/Property/Systemd.hs @@ -88,9 +88,9 @@ container name system ps = Container name system ps (Host name [] mempty) nspawned :: Container -> RevertableProperty nspawned c@(Container name system _ h) = RevertableProperty setup teardown where - setup = propertyList ("nspawned " ++ name) $ + setup = combineProperties ("nspawned " ++ name) $ map toProp steps ++ [containerprovisioned] - teardown = propertyList ("not nspawned " ++ name) $ + teardown = combineProperties ("not nspawned " ++ name) $ map (toProp . revert) (reverse steps) steps = [ enterScript c @@ -102,16 +102,16 @@ nspawned c@(Container name system _ h) = RevertableProperty setup teardown -- that only has the Property of systemd being installed. -- This is to avoid starting any daemons in the chroot, -- which would not run in the container's namespace. - chrootprovisioned = Chroot.provisioned $ + chrootprovisioned = Chroot.provisioned' (Chroot.propigateChrootInfo chroot) $ mkChroot $ h { hostProperties = [installed] } -- Use nsenter to enter container and and run propellor to -- finish provisioning. - containerprovisioned = Chroot.propellChroot - (mkChroot h) + containerprovisioned = Chroot.propellChroot chroot (enterContainerProcess c) mkChroot = Chroot.Chroot (containerDir name) system + chroot = mkChroot h nspawnService :: Container -> RevertableProperty nspawnService (Container name _ ps _) = RevertableProperty setup teardown -- cgit v1.2.3