fix info propigation
Need to propigate the full container info, not the subset used in chroot deployment.
This commit is contained in:
parent
5e1a47552a
commit
7d4d3e4451
|
@ -3,6 +3,8 @@ module Propellor.Property.Chroot (
|
||||||
chroot,
|
chroot,
|
||||||
provisioned,
|
provisioned,
|
||||||
-- * Internal use
|
-- * Internal use
|
||||||
|
provisioned',
|
||||||
|
propigateChrootInfo,
|
||||||
propellChroot,
|
propellChroot,
|
||||||
chain,
|
chain,
|
||||||
) where
|
) 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
|
-- Reverting this property removes the chroot. Note that it does not ensure
|
||||||
-- that any processes that might be running inside the chroot are stopped.
|
-- that any processes that might be running inside the chroot are stopped.
|
||||||
provisioned :: Chroot -> RevertableProperty
|
provisioned :: Chroot -> RevertableProperty
|
||||||
provisioned c@(Chroot loc system _) = RevertableProperty
|
provisioned c = provisioned' (propigateChrootInfo c) c
|
||||||
(propigateChrootInfo c (go "exists" setup))
|
|
||||||
|
provisioned' :: (Property -> Property) -> Chroot -> RevertableProperty
|
||||||
|
provisioned' propigator c@(Chroot loc system _) = RevertableProperty
|
||||||
|
(propigator $ go "exists" setup)
|
||||||
(go "removed" teardown)
|
(go "removed" teardown)
|
||||||
where
|
where
|
||||||
go desc a = property (chrootDesc c desc) $ ensureProperties [a]
|
go desc a = property (chrootDesc c desc) $ ensureProperties [a]
|
||||||
|
|
|
@ -88,9 +88,9 @@ container name system ps = Container name system ps (Host name [] mempty)
|
||||||
nspawned :: Container -> RevertableProperty
|
nspawned :: Container -> RevertableProperty
|
||||||
nspawned c@(Container name system _ h) = RevertableProperty setup teardown
|
nspawned c@(Container name system _ h) = RevertableProperty setup teardown
|
||||||
where
|
where
|
||||||
setup = propertyList ("nspawned " ++ name) $
|
setup = combineProperties ("nspawned " ++ name) $
|
||||||
map toProp steps ++ [containerprovisioned]
|
map toProp steps ++ [containerprovisioned]
|
||||||
teardown = propertyList ("not nspawned " ++ name) $
|
teardown = combineProperties ("not nspawned " ++ name) $
|
||||||
map (toProp . revert) (reverse steps)
|
map (toProp . revert) (reverse steps)
|
||||||
steps =
|
steps =
|
||||||
[ enterScript c
|
[ enterScript c
|
||||||
|
@ -102,16 +102,16 @@ nspawned c@(Container name system _ h) = RevertableProperty setup teardown
|
||||||
-- that only has the Property of systemd being installed.
|
-- that only has the Property of systemd being installed.
|
||||||
-- This is to avoid starting any daemons in the chroot,
|
-- This is to avoid starting any daemons in the chroot,
|
||||||
-- which would not run in the container's namespace.
|
-- which would not run in the container's namespace.
|
||||||
chrootprovisioned = Chroot.provisioned $
|
chrootprovisioned = Chroot.provisioned' (Chroot.propigateChrootInfo chroot) $
|
||||||
mkChroot $ h { hostProperties = [installed] }
|
mkChroot $ h { hostProperties = [installed] }
|
||||||
|
|
||||||
-- Use nsenter to enter container and and run propellor to
|
-- Use nsenter to enter container and and run propellor to
|
||||||
-- finish provisioning.
|
-- finish provisioning.
|
||||||
containerprovisioned = Chroot.propellChroot
|
containerprovisioned = Chroot.propellChroot chroot
|
||||||
(mkChroot h)
|
|
||||||
(enterContainerProcess c)
|
(enterContainerProcess c)
|
||||||
|
|
||||||
mkChroot = Chroot.Chroot (containerDir name) system
|
mkChroot = Chroot.Chroot (containerDir name) system
|
||||||
|
chroot = mkChroot h
|
||||||
|
|
||||||
nspawnService :: Container -> RevertableProperty
|
nspawnService :: Container -> RevertableProperty
|
||||||
nspawnService (Container name _ ps _) = RevertableProperty setup teardown
|
nspawnService (Container name _ ps _) = RevertableProperty setup teardown
|
||||||
|
|
Loading…
Reference in New Issue