<feed xmlns='http://www.w3.org/2005/Atom'>
<title>propellor/src/Propellor/Property/Conductor.hs, branch master</title>
<subtitle>gnusosa's centralized propellor repository for hosts spin-up.
</subtitle>
<id>https://git.gnusosa.net/propellor/atom?h=master</id>
<link rel='self' href='https://git.gnusosa.net/propellor/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/'/>
<updated>2018-04-23T17:20:13Z</updated>
<entry>
<title>semigroup monoid change fallout; drop ghc 7 support</title>
<updated>2018-04-23T17:20:13Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2018-04-23T17:20:13Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=9228bda32f0a3f6d52e7cc5eb444376e7b024d8c'/>
<id>urn:sha1:9228bda32f0a3f6d52e7cc5eb444376e7b024d8c</id>
<content type='text'>
Fix build with ghc 8.4, which broke due to the Semigroup Monoid change.
See https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid

Dropped support for building propellor with ghc 7 (as in debian
oldstable), to avoid needing to depend on the semigroups transitional
package, but also because it's just too old to be worth supporting.

If we indeed drop ghc 7 support entirely, some code to support "jessie"
can be removed; concurrent-output can be de-embedded, and the Singletons
code can be simplified.

This commit was sponsored by Jack Hill on Patreon.
</content>
</entry>
<entry>
<title>don't propagate DNS info from DiskImage chroots</title>
<updated>2017-03-11T20:52:00Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2017-03-11T20:52:00Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=9a54ba471986b994f10ad332f27639059c18e7e1'/>
<id>urn:sha1:9a54ba471986b994f10ad332f27639059c18e7e1</id>
<content type='text'>
* DiskImage building properties used to propagate DNS info out from
  the chroot used to build the disk image to the Host. That is no longer
  done, since that chroot only exists as a side effect of the disk image
  creation and servers will not be running in it.
* The IsInfo types class's propagateInfo function changed to use a
  PropagateInfo data type. (API change)

This is particularly important when using hostChroot, since the host could
well have DNS settings then.

This commit was sponsored by Ole-Morten Duesund on Patreon.
</content>
</entry>
<entry>
<title>improve haddocks and move code around to make them more clear</title>
<updated>2016-03-27T23:59:20Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-27T23:59:20Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=9d6dc29555b8499d8ae6c73c891b0b5dc19f83e5'/>
<id>urn:sha1:9d6dc29555b8499d8ae6c73c891b0b5dc19f83e5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ported DiskImage</title>
<updated>2016-03-27T20:10:43Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-27T20:10:43Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=0b0ea182ab3301ade8b87b1be1cdecc3464cd1da'/>
<id>urn:sha1:0b0ea182ab3301ade8b87b1be1cdecc3464cd1da</id>
<content type='text'>
Unfortunately, DiskImage needs to add properties to the Chroot it's
presented with, and the metatypes are not included in the Chroot, so it
can't guarantee that the properties it's adding match the OS in the Chroot.

I partially worked around this by making the properties that DiskImage adds
check the OS, so they don't assume Debian.

It would be nicer to parameterize the Chroot type with the metatypes of the
inner OS. I worked for several hours on a patch along those lines, but it
doesn't quite compile. Failed at the final hurdle :/ The patch is below
for later..

--- src/Propellor/Property/Chroot.hs	2016-03-27 16:06:44.285464820 -0400
+++ /home/joey/Chroot.hs	2016-03-27 15:32:29.073416143 -0400
@@ -1,9 +1,9 @@
-{-# LANGUAGE FlexibleContexts, GADTs, DeriveDataTypeable #-}
+{-# LANGUAGE FlexibleContexts, GADTs, DeriveDataTypeable, MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances, DataKinds #-}

 module Propellor.Property.Chroot (
 	debootstrapped,
 	bootstrapped,
-	provisioned,
+	--provisioned,
 	Chroot(..),
 	ChrootBootstrapper(..),
 	Debootstrapped(..),
@@ -11,7 +11,7 @@
 	noServices,
 	inChroot,
 	-- * Internal use
-	provisioned',
+	--provisioned',
 	propagateChrootInfo,
 	propellChroot,
 	chain,
@@ -20,6 +20,7 @@

 import Propellor.Base
 import Propellor.Container
+import Propellor.Types.MetaTypes
 import Propellor.Types.CmdLine
 import Propellor.Types.Chroot
 import Propellor.Types.Info
@@ -38,27 +39,29 @@

 -- | Specification of a chroot. Normally you'll use `debootstrapped` or
 -- `bootstrapped` to construct a Chroot value.
-data Chroot where
-	Chroot :: ChrootBootstrapper b =&gt; FilePath -&gt; b -&gt; Host -&gt; Chroot
-
-instance IsContainer Chroot where
-	containerProperties (Chroot _ _ h) = containerProperties h
-	containerInfo (Chroot _ _ h) = containerInfo h
-	setContainerProperties (Chroot loc b h) ps = Chroot loc b (setContainerProperties h ps)
+--
+-- The inner and outer type variables are the metatypes of the inside of
+-- the chroot and the system it runs in.
+data Chroot inner outer where
+	Chroot :: ChrootBootstrapper b inner outer =&gt; FilePath -&gt; b -&gt; Host -&gt; (inner, outer) -&gt; Chroot inner outer
+
+instance IsContainer (Chroot inner outer) where
+	containerProperties (Chroot _ _ h _) = containerProperties h
+	containerInfo (Chroot _ _ h _) = containerInfo h

-chrootSystem :: Chroot -&gt; Maybe System
+chrootSystem :: Chroot inner outer -&gt; Maybe System
 chrootSystem = fromInfoVal . fromInfo . containerInfo

-instance Show Chroot where
-	show c@(Chroot loc _ _) = "Chroot " ++ loc ++ " " ++ show (chrootSystem c)
+instance Show (Chroot inner outer) where
+	show c@(Chroot loc _ _ _) = "Chroot " ++ loc ++ " " ++ show (chrootSystem c)

 -- | Class of things that can do initial bootstrapping of an operating
 -- System in a chroot.
-class ChrootBootstrapper b where
+class ChrootBootstrapper b inner outer where
 	-- | Do initial bootstrapping of an operating system in a chroot.
 	-- If the operating System is not supported, return
 	-- Left error message.
-	buildchroot :: b -&gt; Maybe System -&gt; FilePath -&gt; Either String (Property Linux)
+	buildchroot :: b -&gt; Maybe System -&gt; FilePath -&gt; Either String (Property outer)

 -- | Use this to bootstrap a chroot by extracting a tarball.
 --
@@ -68,9 +71,8 @@
 -- detect automatically.
 data ChrootTarball = ChrootTarball FilePath

-instance ChrootBootstrapper ChrootTarball where
-	buildchroot (ChrootTarball tb) _ loc = Right $
-		tightenTargets $ extractTarball loc tb
+instance ChrootBootstrapper ChrootTarball UnixLike UnixLike where
+	buildchroot (ChrootTarball tb) _ loc = Right $ extractTarball loc tb

 extractTarball :: FilePath -&gt; FilePath -&gt; Property UnixLike
 extractTarball target src = check (unpopulated target) $
@@ -88,7 +90,7 @@
 -- | Use this to bootstrap a chroot with debootstrap.
 data Debootstrapped = Debootstrapped Debootstrap.DebootstrapConfig

-instance ChrootBootstrapper Debootstrapped where
+instance ChrootBootstrapper Debootstrapped DebianLike Linux where
 	buildchroot (Debootstrapped cf) system loc = case system of
 		(Just s@(System (Debian _) _)) -&gt; Right $ debootstrap s
 		(Just s@(System (Buntish _) _)) -&gt; Right $ debootstrap s
@@ -107,13 +109,22 @@
 -- &gt;	&amp; osDebian Unstable "amd64"
 -- &gt;	&amp; Apt.installed ["ghc", "haskell-platform"]
 -- &gt;	&amp; ...
-debootstrapped :: Debootstrap.DebootstrapConfig -&gt; FilePath -&gt; Chroot
+-- debootstrapped :: Debootstrap.DebootstrapConfig -&gt; FilePath -&gt; Chroot DebianLike
+debootstrapped
+	:: (SingI inner, SingI outer, ChrootBootstrapper Debootstrapped (MetaTypes inner) (MetaTypes outer))
+	=&gt; Debootstrap.DebootstrapConfig
+	-&gt; FilePath
+	-&gt; Chroot (MetaTypes inner) (MetaTypes outer)
 debootstrapped conf = bootstrapped (Debootstrapped conf)

 -- | Defines a Chroot at the given location, bootstrapped with the
 -- specified ChrootBootstrapper.
-bootstrapped :: ChrootBootstrapper b =&gt; b -&gt; FilePath -&gt; Chroot
-bootstrapped bootstrapper location = Chroot location bootstrapper h
+bootstrapped
+	:: (SingI inner, SingI outer, ChrootBootstrapper b (MetaTypes inner) (MetaTypes outer))
+	=&gt; b
+	-&gt; FilePath
+	-&gt; Chroot (MetaTypes inner) (MetaTypes outer)
+bootstrapped bootstrapper location = Chroot location bootstrapper h (sing, sing)
   where
 	h = Host location [] mempty

@@ -123,45 +134,79 @@
 -- Reverting this property removes the chroot. Anything mounted inside it
 -- is first unmounted. Note that it does not ensure that any processes
 -- that might be running inside the chroot are stopped.
-provisioned :: Chroot -&gt; RevertableProperty (HasInfo + Linux) Linux
+-- provisioned :: SingI outer =&gt; Chroot inner outer -&gt; RevertableProperty (HasInfo + MetaTypes outer) Linux
+provisioned
+	::
+		( SingI outer
+		, SingI metatypes
+		, Combines (Property (MetaTypes outer)) (Property (MetaTypes outer))
+		, (HasInfo + outer) ~ MetaTypes metatypes
+		, CombinedType (Property (MetaTypes outer)) (Property (MetaTypes outer)) ~ Property outer
+		, IncludesInfo (MetaTypes metatypes) ~ 'True)
+	=&gt; Chroot inner outer -&gt; RevertableProperty (HasInfo + outer) Linux
 provisioned c = provisioned' (propagateChrootInfo c) c False

 provisioned'
-	:: (Property Linux -&gt; Property (HasInfo + Linux))
-	-&gt; Chroot
+	::
+		( Combines (Property (MetaTypes outer)) (Property (MetaTypes outer))
+		, CombinedType (Property (MetaTypes outer)) (Property (MetaTypes outer)) ~ Property outer
+		, SingI outer
+		)
+	=&gt; (Property outer -&gt; Property (HasInfo + outer))
+	-&gt; Chroot inner outer
 	-&gt; Bool
-	-&gt; RevertableProperty (HasInfo + Linux) Linux
-provisioned' propigator c@(Chroot loc bootstrapper _) systemdonly =
-	(propigator $ setup `describe` chrootDesc c "exists")
+	-&gt; RevertableProperty (HasInfo + outer) Linux
+provisioned' propigator c systemdonly =
+	(propigator $ setup c systemdonly `describe` chrootDesc c "exists")
 		&lt;!&gt;
-	(teardown `describe` chrootDesc c "removed")
-  where
-	setup :: Property Linux
-	setup = propellChroot c (inChrootProcess (not systemdonly) c) systemdonly
-		`requires` built
-
-	built = case buildchroot bootstrapper (chrootSystem c) loc of
-		Right p -&gt; p
-		Left e -&gt; cantbuild e
-
-	cantbuild e = property (chrootDesc c "built") (error e)
-
-	teardown :: Property Linux
-	teardown = check (not &lt;$&gt; unpopulated loc) $
-		property ("removed " ++ loc) $
-			makeChange (removeChroot loc)
-
-propagateChrootInfo :: Chroot -&gt; Property Linux -&gt; Property (HasInfo + Linux)
-propagateChrootInfo c@(Chroot location _ _) p = propagateContainer location c $
-	p `addInfoProperty` chrootInfo c
+	(teardown c `describe` chrootDesc c "removed")

-chrootInfo :: Chroot -&gt; Info
-chrootInfo (Chroot loc _ h) = mempty `addInfo`
+-- chroot removal code is currently linux specific..
+teardown :: Chroot inner outer -&gt; Property Linux
+teardown (Chroot loc _ _ _) = check (not &lt;$&gt; unpopulated loc) $
+	property ("removed " ++ loc) $
+		makeChange (removeChroot loc)
+
+setup
+	::
+		( SingI outer
+		, Combines (Property (MetaTypes outer)) (Property (MetaTypes outer))
+		)
+	=&gt; Chroot inner outer
+	-&gt; Bool
+	-&gt; CombinedType (Property (MetaTypes outer)) (Property (MetaTypes outer))
+setup c systemdonly = propellChroot c (inChrootProcess (not systemdonly) c) systemdonly
+	`requires` built c
+
+built :: (SingI outer, ChrootBootstrapper b inner outer) =&gt; Chroot inner outer -&gt; Property (MetaTypes outer)
+built c@(Chroot loc bootstrapper _ _) =
+	case buildchroot bootstrapper (chrootSystem c) loc of
+		Right p -&gt; error "FOO" -- p
+		Left e -&gt; error "FOO" -- cantbuild c e
+
+cantbuild :: Chroot inner outer -&gt; String -&gt; Property UnixLike
+cantbuild c e = property (chrootDesc c "built") (error e)
+
+propagateChrootInfo
+	::
+		( SingI metatypes
+		, (HasInfo + outer) ~ MetaTypes metatypes
+		, IncludesInfo (MetaTypes metatypes) ~ 'True
+		)
+	=&gt; Chroot inner outer
+	-&gt; Property outer
+	-&gt; Property (MetaTypes metatypes)
+propagateChrootInfo c@(Chroot location _ _ _) p =
+	propagateContainer location c $
+		p `addInfoProperty` chrootInfo c
+
+chrootInfo :: Chroot inner outer -&gt; Info
+chrootInfo (Chroot loc _ h _) = mempty `addInfo`
 	mempty { _chroots = M.singleton loc h }

 -- | Propellor is run inside the chroot to provision it.
-propellChroot :: Chroot -&gt; ([String] -&gt; IO (CreateProcess, IO ())) -&gt; Bool -&gt; Property UnixLike
-propellChroot c@(Chroot loc _ _) mkproc systemdonly = property (chrootDesc c "provisioned") $ do
+propellChroot :: SingI outer =&gt; Chroot inner outer -&gt; ([String] -&gt; IO (CreateProcess, IO ())) -&gt; Bool -&gt; Property (MetaTypes outer)
+propellChroot c@(Chroot loc _ _ _) mkproc systemdonly = property (chrootDesc c "provisioned") $ do
 	let d = localdir &lt;/&gt; shimdir c
 	let me = localdir &lt;/&gt; "propellor"
 	shim &lt;- liftIO $ ifM (doesDirectoryExist d)
@@ -199,8 +244,8 @@
 		liftIO cleanup
 		return r

-toChain :: HostName -&gt; Chroot -&gt; Bool -&gt; IO CmdLine
-toChain parenthost (Chroot loc _ _) systemdonly = do
+toChain :: HostName -&gt; Chroot inner outer -&gt; Bool -&gt; IO CmdLine
+toChain parenthost (Chroot loc _ _ _) systemdonly = do
 	onconsole &lt;- isConsole &lt;$&gt; getMessageHandle
 	return $ ChrootChain parenthost loc systemdonly onconsole

@@ -224,8 +269,8 @@
 			putStrLn $ "\n" ++ show r
 chain _ _ = errorMessage "bad chain command"

-inChrootProcess :: Bool -&gt; Chroot -&gt; [String] -&gt; IO (CreateProcess, IO ())
-inChrootProcess keepprocmounted (Chroot loc _ _) cmd = do
+inChrootProcess :: Bool -&gt; Chroot inner outer -&gt; [String] -&gt; IO (CreateProcess, IO ())
+inChrootProcess keepprocmounted (Chroot loc _ _ _) cmd = do
 	mountproc
 	return (proc "chroot" (loc:cmd), cleanup)
   where
@@ -244,26 +289,24 @@
 provisioningLock :: FilePath -&gt; FilePath
 provisioningLock containerloc = "chroot" &lt;/&gt; mungeloc containerloc ++ ".lock"

-shimdir :: Chroot -&gt; FilePath
-shimdir (Chroot loc _ _) = "chroot" &lt;/&gt; mungeloc loc ++ ".shim"
+shimdir :: Chroot inner outer -&gt; FilePath
+shimdir (Chroot loc _ _ _) = "chroot" &lt;/&gt; mungeloc loc ++ ".shim"

 mungeloc :: FilePath -&gt; String
 mungeloc = replace "/" "_"

-chrootDesc :: Chroot -&gt; String -&gt; String
-chrootDesc (Chroot loc _ _) desc = "chroot " ++ loc ++ " " ++ desc
+chrootDesc :: Chroot inner outer -&gt; String -&gt; String
+chrootDesc (Chroot loc _ _ _) desc = "chroot " ++ loc ++ " " ++ desc
</content>
</entry>
<entry>
<title>ported docker</title>
<updated>2016-03-27T01:38:39Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-27T01:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=46fc5467e633a9c1f149cb0cd7ee03af1e9e0aa1'/>
<id>urn:sha1:46fc5467e633a9c1f149cb0cd7ee03af1e9e0aa1</id>
<content type='text'>
Also, implemented modifyHostProps to add properties to an existing host.
Using it bypasses some type safety. Its use in docker is safe though.

But, in Conductor, the use of it was not really safe, because it was used
with a DebianLike property. Fixed that by making Ssh.installed
target all unix's, although it will fail on non-DebianLike ones.
</content>
</entry>
<entry>
<title>ported propagateContainer</title>
<updated>2016-03-26T23:31:23Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-26T23:31:23Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=36e97137e538de401bd0340b469e10dca5f4b475'/>
<id>urn:sha1:36e97137e538de401bd0340b469e10dca5f4b475</id>
<content type='text'>
Renamed several utility functions along the way.
</content>
</entry>
<entry>
<title>finished porting conductor</title>
<updated>2016-03-26T21:56:42Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-26T21:56:42Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=009cff24bd7a43a5a35300af7a22a99570840195'/>
<id>urn:sha1:009cff24bd7a43a5a35300af7a22a99570840195</id>
<content type='text'>
</content>
</entry>
<entry>
<title>more porting</title>
<updated>2016-03-26T21:47:21Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2016-03-26T21:47:21Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=8cbf4c96bdb77350a233c6f0934458b8486ce11e'/>
<id>urn:sha1:8cbf4c96bdb77350a233c6f0934458b8486ce11e</id>
<content type='text'>
Conductor WIP
</content>
</entry>
<entry>
<title>Explicit Info/NoInfo for RevertableProperty (API change)</title>
<updated>2015-10-27T18:37:02Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2015-10-27T18:34:10Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=56c3394144abbb9862dc67379d3253c76ae4df97'/>
<id>urn:sha1:56c3394144abbb9862dc67379d3253c76ae4df97</id>
<content type='text'>
RevertableProperty used to be assumed to contain info, but this is now made
explicit, with RevertableProperty HasInfo or RevertableProperty NoInfo.

Transition guide:

    - If you define a RevertableProperty, expect some type check
      failures like: "Expecting one more argument to ‘RevertableProperty’".
    - Change it to "RevertableProperty NoInfo"
    - The compiler will then tell you if it needs "HasInfo" instead.
    - If you have code that uses the RevertableProperty constructor
      that fails to type check, use the more powerful &lt;!&gt; operator
</content>
</entry>
<entry>
<title>fix build warnings</title>
<updated>2015-10-21T23:47:00Z</updated>
<author>
<name>Joey Hess</name>
<email>joeyh@joeyh.name</email>
</author>
<published>2015-10-21T23:47:00Z</published>
<link rel='alternate' type='text/html' href='https://git.gnusosa.net/propellor/commit/?id=85f08ee913a77c16ba4d264581b1240468c4ebb2'/>
<id>urn:sha1:85f08ee913a77c16ba4d264581b1240468c4ebb2</id>
<content type='text'>
</content>
</entry>
</feed>
