Merge branch 'joeyconfig'

This commit is contained in:
Joey Hess 2014-12-09 00:05:34 -04:00
commit 5752080929
4 changed files with 18 additions and 19 deletions

7
debian/changelog vendored
View File

@ -1,9 +1,12 @@
propellor (1.1.1) UNRELEASED; urgency=medium propellor (1.2.0) unstable; urgency=medium
* Display a warning when ensureProperty is used on a property which has * Display a warning when ensureProperty is used on a property which has
Info and is so prevented from propigating it. Info and is so prevented from propigating it.
* Removed boolProperty; instead the new toResult can be used. (API change)
* Include Propellor.Property.OS, which was accidentially left out of the
cabal file in the last release.
-- Joey Hess <id@joeyh.name> Sun, 07 Dec 2014 17:08:55 -0400 -- Joey Hess <id@joeyh.name> Tue, 09 Dec 2014 00:05:09 -0400
propellor (1.1.0) unstable; urgency=medium propellor (1.1.0) unstable; urgency=medium

View File

@ -1,5 +1,5 @@
Name: propellor Name: propellor
Version: 1.1.0 Version: 1.2.0
Cabal-Version: >= 1.6 Cabal-Version: >= 1.6
License: BSD3 License: BSD3
Maintainer: Joey Hess <id@joeyh.name> Maintainer: Joey Hess <id@joeyh.name>
@ -90,6 +90,7 @@ Library
Propellor.Property.Nginx Propellor.Property.Nginx
Propellor.Property.Obnam Propellor.Property.Obnam
Propellor.Property.OpenId Propellor.Property.OpenId
Propellor.Property.OS
Propellor.Property.Postfix Propellor.Property.Postfix
Propellor.Property.Prosody Propellor.Property.Prosody
Propellor.Property.Reboot Propellor.Property.Reboot

View File

@ -148,18 +148,16 @@ sourceInstall = property "debootstrap installed from source" (liftIO sourceInsta
`requires` arInstalled `requires` arInstalled
perlInstalled :: Property perlInstalled :: Property
perlInstalled = check (not <$> inPath "perl") $ property "perl installed" $ do perlInstalled = check (not <$> inPath "perl") $ property "perl installed" $
v <- liftIO $ firstM id liftIO $ toResult . isJust <$> firstM id
[ yumInstall "perl" [ yumInstall "perl"
] ]
if isJust v then return MadeChange else return FailedChange
arInstalled :: Property arInstalled :: Property
arInstalled = check (not <$> inPath "ar") $ property "ar installed" $ do arInstalled = check (not <$> inPath "ar") $ property "ar installed" $
v <- liftIO $ firstM id liftIO $ toResult . isJust <$> firstM id
[ yumInstall "binutils" [ yumInstall "binutils"
] ]
if isJust v then return MadeChange else return FailedChange
yumInstall :: String -> IO Bool yumInstall :: String -> IO Bool
yumInstall p = boolSystem "yum" [Param "-y", Param "install", Param p] yumInstall p = boolSystem "yum" [Param "-y", Param "install", Param p]

View File

@ -13,19 +13,16 @@ type ServiceName = String
-- we can do is try to start the service, and if it fails, assume -- we can do is try to start the service, and if it fails, assume
-- this means it's already running. -- this means it's already running.
running :: ServiceName -> Property running :: ServiceName -> Property
running svc = property ("running " ++ svc) $ do running = signaled "start" "running"
void $ ensureProperty $
scriptProperty ["service " ++ shellEscape svc ++ " start >/dev/null 2>&1 || true"]
return NoChange
restarted :: ServiceName -> Property restarted :: ServiceName -> Property
restarted svc = property ("restarted " ++ svc) $ do restarted = signaled "restart" "restarted"
void $ ensureProperty $
scriptProperty ["service " ++ shellEscape svc ++ " restart >/dev/null 2>&1 || true"]
return NoChange
reloaded :: ServiceName -> Property reloaded :: ServiceName -> Property
reloaded svc = property ("reloaded " ++ svc) $ do reloaded = signaled "reload" "reloaded"
signaled :: String -> Desc -> ServiceName -> Property
signaled cmd desc svc = property (desc ++ " " ++ svc) $ do
void $ ensureProperty $ void $ ensureProperty $
scriptProperty ["service " ++ shellEscape svc ++ " reload >/dev/null 2>&1 || true"] scriptProperty ["service " ++ shellEscape svc ++ " " ++ cmd ++ " >/dev/null 2>&1 || true"]
return NoChange return NoChange