summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-10 03:06:35 -0400
committerJoey Hess2014-04-10 03:06:35 -0400
commit7a0074454bbae2506c102a57add9af17a32907cc (patch)
tree71cdb3e3e57937a433723fee5227536530fb71db /Propellor/Property
parenteb71c76711a3952a1851fea4f80bbf17a0fc61b4 (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/File.hs10
-rw-r--r--Propellor/Property/Git.hs3
2 files changed, 12 insertions, 1 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 0c1155fe..64dce66f 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -58,3 +58,13 @@ fileProperty desc a f = Property desc $ go =<< doesFileExist f
dirExists :: FilePath -> Property
dirExists d = check (not <$> doesDirectoryExist d) $ Property (d ++ " exists") $
makeChange $ createDirectoryIfMissing True d
+
+-- | Ensures that a file/dir has the specified owner and group.
+ownerGroup :: FilePath -> UserName -> GroupName -> Property
+ownerGroup f owner group = Property (f ++ " owner " ++ og) $ do
+ r <- ensureProperty $ cmdProperty "chown" [og, f]
+ if r == FailedChange
+ then return r
+ else noChange
+ where
+ og = owner ++ ":" ++ group
diff --git a/Propellor/Property/Git.hs b/Propellor/Property/Git.hs
index 356ff87a..c0494160 100644
--- a/Propellor/Property/Git.hs
+++ b/Propellor/Property/Git.hs
@@ -22,7 +22,8 @@ daemonRunning exportdir = RevertableProperty setup unsetup
`requires`
Apt.serviceInstalledRunning "openbsd-inetd"
`onChange`
- Service.reloaded "openbsd-inetd"
+ Service.running "openbsd-inetd"
+ `describe` ("git-daemon exporting " ++ exportdir)
unsetup = lacksLine conf (mkl "tcp4")
`requires`
lacksLine conf (mkl "tcp6")