summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-joey.hs14
-rw-r--r--debian/changelog1
-rw-r--r--doc/forum/property_combinator_ordering.mdwn8
-rw-r--r--doc/forum/property_combinator_ordering/comment_1_0ea2186b5cfa7eadaf38ac2e97fc4a2c._comment31
-rw-r--r--src/Propellor/Engine.hs6
-rw-r--r--src/Propellor/Property/Apt.hs6
-rw-r--r--src/Propellor/Property/Docker.hs2
7 files changed, 62 insertions, 6 deletions
diff --git a/config-joey.hs b/config-joey.hs
index 67986ffe..b617ccfa 100644
--- a/config-joey.hs
+++ b/config-joey.hs
@@ -24,9 +24,10 @@ import qualified Propellor.Property.Postfix as Postfix
import qualified Propellor.Property.Grub as Grub
import qualified Propellor.Property.Obnam as Obnam
import qualified Propellor.Property.Gpg as Gpg
-import qualified Propellor.Property.Chroot as Chroot
import qualified Propellor.Property.Systemd as Systemd
+import qualified Propellor.Property.Chroot as Chroot
import qualified Propellor.Property.Debootstrap as Debootstrap
+import qualified Propellor.Property.OS as OS
import qualified Propellor.Property.HostingProvider.DigitalOcean as DigitalOcean
import qualified Propellor.Property.HostingProvider.CloudAtCost as CloudAtCost
import qualified Propellor.Property.HostingProvider.Linode as Linode
@@ -48,8 +49,17 @@ hosts = -- (o) `
, diatom
, elephant
, alien
+ , testvm
] ++ monsters
+testvm :: Host
+testvm = host "testvm.kitenet.net"
+ & Chroot.provisioned (Chroot.debootstrapped (System (Debian Unstable) "amd64") Debootstrap.DefaultConfig "/new-os")
+ -- & OS.cleanInstall (OS.Confirmed "foo.example.com") []
+ -- `onChange` propertyList "fixing up after clean install"
+ -- [
+ -- ]
+
darkstar :: Host
darkstar = host "darkstar.kitenet.net"
& ipv6 "2001:4830:1600:187::2" -- sixxs tunnel
@@ -120,7 +130,7 @@ orca = standardSystem "orca.kitenet.net" Unstable "amd64"
-- multiuser system with eg, user passwords that are not deployed
-- with propellor.
kite :: Host
-kite = standardSystemUnhardened "kite.kitenet.net" Unstable "amd64"
+kite = standardSystemUnhardened "kite.kitenet.net" Testing "amd64"
[ "Welcome to the new kitenet.net server!"
]
& ipv4 "66.228.36.95"
diff --git a/debian/changelog b/debian/changelog
index 17801470..aa191650 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ propellor (1.1.0) UNRELEASED; urgency=medium
This is more robust.
* propellor.debug can be set in the git config to enable more persistent
debugging output.
+ * Run apt-cache policy with LANG=C.
-- Joey Hess <joeyh@debian.org> Sat, 22 Nov 2014 00:12:35 -0400
diff --git a/doc/forum/property_combinator_ordering.mdwn b/doc/forum/property_combinator_ordering.mdwn
new file mode 100644
index 00000000..25549bb4
--- /dev/null
+++ b/doc/forum/property_combinator_ordering.mdwn
@@ -0,0 +1,8 @@
+when I write
+
+ setDistribution cfg = f `File.hasContent` cfg
+ `onChange` update
+ `requires` File.dirExists confDir
+
+is update called before ensuring the confiDir Exist ?
+It seems to me but who knows ?
diff --git a/doc/forum/property_combinator_ordering/comment_1_0ea2186b5cfa7eadaf38ac2e97fc4a2c._comment b/doc/forum/property_combinator_ordering/comment_1_0ea2186b5cfa7eadaf38ac2e97fc4a2c._comment
new file mode 100644
index 00000000..c41abd90
--- /dev/null
+++ b/doc/forum/property_combinator_ordering/comment_1_0ea2186b5cfa7eadaf38ac2e97fc4a2c._comment
@@ -0,0 +1,31 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2014-12-01T15:53:11Z"
+ content="""
+I think that should behave intuitively, but of course if you're unsure
+of this kind of thing, adding parens is a good way to disambiguate the
+code.
+
+ (f `File.hasContent` cfg `onChange` update)
+ `requires` File.dirExists confDir
+
+Written that way, it's explicit that the parenthesized part runs
+together as one action.
+
+Or, we can do a quick test in ghci:
+
+ joey@darkstar:~/src/propellor/src#joeyconfig>ghci Propellor.hs Propellor/Property.hs
+ *Propellor> let f1 = property "hasContent" (liftIO (print "f1") >> return MadeChange)
+ *Propellor> let f2 = property "update" (liftIO (print "f2") >> return MadeChange)
+ *Propellor> let f3 = property "dirExists" (liftIO (print "f3") >> return MadeChange)
+ *Propellor> runPropellor (Host "foo" [] mempty) $ ensureProperty $ f1 `onChange` f2 `requires` f3
+ "dirExists"
+ "hasContent"
+ "update"
+ MadeChange
+
+So, yes, it's behaving as it should, first ensuring that the `requires`
+property is met, and then running the main property, and since it made a
+change, following up by running the `onChange` property.
+"""]]
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index 0b65fb7e..81cc2397 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -77,12 +77,16 @@ processChainOutput h = go Nothing
where
go lastline = do
v <- catchMaybeIO (hGetLine h)
+ debug ["read from chained propellor: ", show v]
case v of
Nothing -> case lastline of
- Nothing -> pure FailedChange
+ Nothing -> do
+ debug ["chained propellor output nothing; assuming it failed"]
+ return FailedChange
Just l -> case readish l of
Just r -> pure r
Nothing -> do
+ debug ["chained propellor output did not end with a Result; assuming it failed"]
putStrLn l
hFlush stdout
return FailedChange
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 471d6195..68e877ed 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -193,13 +193,15 @@ isInstalled p = (== [True]) <$> isInstalled' [p]
-- even vary. If apt does not know about a package at all, it will not
-- be included in the result list.
isInstalled' :: [Package] -> IO [Bool]
-isInstalled' ps = catMaybes . map parse . lines
- <$> readProcess "apt-cache" ("policy":ps)
+isInstalled' ps = catMaybes . map parse . lines <$> policy
where
parse l
| "Installed: (none)" `isInfixOf` l = Just False
| "Installed: " `isInfixOf` l = Just True
| otherwise = Nothing
+ policy = do
+ environ <- addEntry "LANG" "C" <$> getEnvironment
+ readProcessEnv "apt-cache" ("policy":ps) (Just environ)
autoRemove :: Property
autoRemove = runApt ["-y", "autoremove"]
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 586ebc2e..5fa06517 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -430,7 +430,7 @@ provisionContainer cid = containerDesc cid $ property "provisioned" $ liftIO $ d
let params = ["--continue", show $ toChain cid]
msgh <- mkMessageHandle
let p = inContainerProcess cid
- [ if isConsole msgh then "-it" else "-i" ]
+ (if isConsole msgh then ["-it"] else [])
(shim : params)
r <- withHandle StdoutHandle createProcessSuccess p $
processChainOutput