summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2016-06-16 22:12:28 -0400
committerJoey Hess2016-06-16 22:12:28 -0400
commitd72333ae80c7331db26b2c622f1b7abeb75e44e8 (patch)
tree7780ef73c2c5f533d30c72589a3edf70763d5774
parent2ba2b37d975c921b3e80811e77579ff93e7af250 (diff)
response
-rw-r--r--doc/forum/Systemd_container_pre-setup_properties/comment_1_420b48d04f16fe5ca7a75c4720e50e1a._comment35
-rw-r--r--src/Propellor/Property/Systemd.hs4
2 files changed, 37 insertions, 2 deletions
diff --git a/doc/forum/Systemd_container_pre-setup_properties/comment_1_420b48d04f16fe5ca7a75c4720e50e1a._comment b/doc/forum/Systemd_container_pre-setup_properties/comment_1_420b48d04f16fe5ca7a75c4720e50e1a._comment
new file mode 100644
index 00000000..45b8afd4
--- /dev/null
+++ b/doc/forum/Systemd_container_pre-setup_properties/comment_1_420b48d04f16fe5ca7a75c4720e50e1a._comment
@@ -0,0 +1,35 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2016-06-17T01:49:24Z"
+ content="""
+Currently, Chroot.provisioned' is passed a `systemdonly :: Bool`,
+which limits the chroot provisioning to the Systemd.installed
+property.
+
+What you want to do needs a more flexible interface there.
+Add a `Maybe ChildProperty` parameter to specify what should be done
+to finish provisioning the chroot.
+
+Then, change the Systemd.Container data type:
+
+ -data Container = Container MachineName Chroot.Chroot Host
+ +data Container metatypes = Container
+ + { containerMachinName :: MachineName
+ + , containerChroot :: Chroot.Chroot
+ + , containerHost :: Host
+ + , containerChrootProvision :: Property metatypes
+ + }
+
+And Systemd.nspawned will pass
+`(Just (toChildProperty (containerChrootProvision c)))` to `Chroot.provisioned'`
+
+Systemd.Container constructor functions will default to setting
+`containerChrootProvision = Systemd.Core.installed`, but
+the user can then change the Container to add more properties
+to run in the chroot when provisioning it.
+
+(There's also a tricky bit where Systemd.nspawned needs to extract any info
+from containerChrootProvision and add it onto its own info to propigate
+it. If you do the rest of it, I will handle this tricky bit..)
+"""]]
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs
index 78529f73..80346889 100644
--- a/src/Propellor/Property/Systemd.hs
+++ b/src/Propellor/Property/Systemd.hs
@@ -64,10 +64,10 @@ type ServiceName = String
type MachineName = String
-data Container = Container MachineName Chroot.Chroot Host
+data Container metatypes = Container MachineName Chroot.Chroot Host (Property metatypes)
deriving (Show)
-instance IsContainer Container where
+instance IsContainer (Container metatypes) where
containerProperties (Container _ _ h) = containerProperties h
containerInfo (Container _ _ h) = containerInfo h
setContainerProperties (Container n c h) ps = Container n c (setContainerProperties h ps)