From f116d6be5f29c53bb0941fb45a8180c547d777cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:00:37 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 73a8f71f..2a6dffe4 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -169,3 +169,20 @@ mainhttpscert True = , " SSLCertificateKeyFile /etc/ssl/private/web.pem" , " SSLCertificateChainFile /etc/ssl/certs/startssl.pem" ] + + +annexRsyncServer :: Property +annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" + [ Apt.installed ["rsync"] + , File.hasPrivContent "/etc/rsyncd.conf" + , File.hasPrivContent "/etc/rsyncd.secrets" + , "/etc/default/rsync" `File.containsLine` "RSYNC_ENABLE=true" + `onChange` Service.running "rsync" + , endpoint "/srv/web/downloads.kitenet.net/git-annex/autobuild" + , endpoint "/srv/web/downloads.kitenet.net/git-annex/autobuild/x86_64-apple-mavericks" + ] + where + endpoint d = combineProperties ("endpoint " ++ d) + [ File.dirExists d + , File.ownerGroup d "joey" "joey" + ] -- cgit v1.2.3 From 2097be5ff4a01a6acc9063ce9b62928a5f892b73 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:04:18 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 2 ++ config-joey.hs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 2a6dffe4..4f760640 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -127,6 +127,8 @@ annexWebSite hosts origin hn uuid remotes = propertyList (hn ++" website using g , " " , " Options Indexes FollowSymLinks ExecCGI" , " AllowOverride None" + , " AddHandler cgi-script .cgi" + , " DirectoryIndex index.cgi" , " Order allow,deny" , " allow from all" , " " diff --git a/config-joey.hs b/config-joey.hs index 166e84e4..e5ccac3b 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -18,7 +18,6 @@ import qualified Propellor.Property.OpenId as OpenId import qualified Propellor.Property.Docker as Docker import qualified Propellor.Property.Git as Git import qualified Propellor.Property.Apache as Apache -import qualified Propellor.Property.Service as Service import qualified Propellor.Property.SiteSpecific.GitHome as GitHome import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites -- cgit v1.2.3 From 0f08c035c7bafe13b59e3e91b426e93ee8e5092a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:05:42 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 4f760640..7ef6e945 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -128,7 +128,7 @@ annexWebSite hosts origin hn uuid remotes = propertyList (hn ++" website using g , " Options Indexes FollowSymLinks ExecCGI" , " AllowOverride None" , " AddHandler cgi-script .cgi" - , " DirectoryIndex index.cgi" + , " DirectoryIndex index.html index.cgi" , " Order allow,deny" , " allow from all" , " " -- cgit v1.2.3 From d71f8caad4576ff55a147d7d7934c8bc436519de Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:09:41 -0400 Subject: propellor spin --- Propellor/Property.hs | 13 +++++++++++++ Propellor/Property/Apache.hs | 8 ++++---- Propellor/Property/Apt.hs | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property.hs b/Propellor/Property.hs index 95d17c05..5b1800ef 100644 --- a/Propellor/Property.hs +++ b/Propellor/Property.hs @@ -92,6 +92,19 @@ check c property = Property (propertyDesc property) $ ifM (liftIO c) , return NoChange ) +-- | Marks a Property as trivial. It can only return FailedChange or +-- NoChange. +-- +-- Useful when it's just as expensive to check if a change needs +-- to be made as it is to just idempotently assure the property is +-- satisfied. For example, chmodding a file. +trivial :: Property -> Property +trivial p = Property (propertyDesc p) $ do + r <- ensureProperty p + if r == MadeChange + then return NoChange + else return r + -- | Makes a property that is satisfied differently depending on the host's -- operating system. -- diff --git a/Propellor/Property/Apache.hs b/Propellor/Property/Apache.hs index f45ef9df..cf3e62cc 100644 --- a/Propellor/Property/Apache.hs +++ b/Propellor/Property/Apache.hs @@ -10,12 +10,12 @@ type ConfigFile = [String] siteEnabled :: HostName -> ConfigFile -> RevertableProperty siteEnabled hn cf = RevertableProperty enable disable where - enable = cmdProperty "a2ensite" ["--quiet", hn] + enable = trivial $ cmdProperty "a2ensite" ["--quiet", hn] `describe` ("apache site enabled " ++ hn) `requires` siteAvailable hn cf `requires` installed `onChange` reloaded - disable = File.notPresent (siteCfg hn) + disable = trivial $ File.notPresent (siteCfg hn) `describe` ("apache site disabled " ++ hn) `onChange` cmdProperty "a2dissite" ["--quiet", hn] `requires` installed @@ -30,11 +30,11 @@ siteAvailable hn cf = siteCfg hn `File.hasContent` (comment:cf) modEnabled :: String -> RevertableProperty modEnabled modname = RevertableProperty enable disable where - enable = cmdProperty "a2enmod" ["--quiet", modname] + enable = trivial $ cmdProperty "a2enmod" ["--quiet", modname] `describe` ("apache module enabled " ++ modname) `requires` installed `onChange` reloaded - disable = cmdProperty "a2dismod" ["--quiet", modname] + disable = trivial $ cmdProperty "a2dismod" ["--quiet", modname] `describe` ("apache module disabled " ++ modname) `requires` installed `onChange` reloaded diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index f45bc2e6..a01ab3cc 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -103,7 +103,7 @@ installed' params ps = robustly $ check (isInstallable ps) go go = runApt $ params ++ ["install"] ++ ps installedBackport :: [Package] -> Property -installedBackport ps = withOS desc $ \o -> case o of +installedBackport ps = trivial $ withOS desc $ \o -> case o of Nothing -> error "cannot install backports; os not declared" (Just (System (Debian suite) _)) | isStable suite -> -- cgit v1.2.3 From fc8d3fe541ab019ac545695fc829af9558c8b1ed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:40:57 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 11 +++++++++++ config-joey.hs | 1 + 2 files changed, 12 insertions(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 7ef6e945..f409b09b 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -188,3 +188,14 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" [ File.dirExists d , File.ownerGroup d "joey" "joey" ] + +twitRss :: Property +twitRss = combineProperties "twitter rss" + [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing + , check (doesFileExist $ dir "twitRss") $ userScriptProperty "joey" + [ "cd " ++ dir + , "ghc --make twitRss" + ] + ] + where + dir = "/srv/web/tmp.kitenet.net/twitrss" diff --git a/config-joey.hs b/config-joey.hs index e5ccac3b..59514557 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -104,6 +104,7 @@ hosts = -- (o) ` "tmp.kitenet.net" "26fd6e38-1226-11e2-a75f-ff007033bdba" [] + & JoeySites.twitRss & Apt.installed ["ntop"] -- cgit v1.2.3 From 6808fe60e1ad7593455d477ff456d8dbfbe75331 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:43:04 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index f409b09b..5a2e1644 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -192,10 +192,11 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" twitRss :: Property twitRss = combineProperties "twitter rss" [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing - , check (doesFileExist $ dir "twitRss") $ userScriptProperty "joey" - [ "cd " ++ dir - , "ghc --make twitRss" - ] + , check (not <$> doesFileExist (dir "twitRss")) $ + userScriptProperty "joey" + [ "cd " ++ dir + , "ghc --make twitRss" + ] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" -- cgit v1.2.3 From 5775643fc0b6da8e58adac49524f82044368c7d6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:43:55 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 5a2e1644..847bd8b9 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -197,6 +197,7 @@ twitRss = combineProperties "twitter rss" [ "cd " ++ dir , "ghc --make twitRss" ] + `requires` Apt.installed ["libghc-xml-dev"] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" -- cgit v1.2.3 From de106741ece5cb2fcf206bd7537b88266d2d38c5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:44:45 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 847bd8b9..c3ddc116 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -197,7 +197,10 @@ twitRss = combineProperties "twitter rss" [ "cd " ++ dir , "ghc --make twitRss" ] - `requires` Apt.installed ["libghc-xml-dev"] + `requires` Apt.installed + [ "libghc-xml-dev" + , "libghc-feed-dev" + ] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" -- cgit v1.2.3 From 23b370398ceb933271cbd19919f2d8b1c6b00188 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:45:36 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index c3ddc116..0c1a1f4f 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -200,6 +200,7 @@ twitRss = combineProperties "twitter rss" `requires` Apt.installed [ "libghc-xml-dev" , "libghc-feed-dev" + , "libghc-http-conduit-dev" ] ] where -- cgit v1.2.3 From 8009591be33e4c589557b1abd5259964b6bd81c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:46:53 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 0c1a1f4f..c6050e7e 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -201,6 +201,7 @@ twitRss = combineProperties "twitter rss" [ "libghc-xml-dev" , "libghc-feed-dev" , "libghc-http-conduit-dev" + , "libghc-tagsoup-dev" ] ] where -- cgit v1.2.3 From ebe1bd3f1b9daed7df6b8aa9f3f3172a2a336b55 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:53:19 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index c6050e7e..d52ddbb3 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -9,6 +9,7 @@ import qualified Propellor.Property.File as File import qualified Propellor.Property.Gpg as Gpg import qualified Propellor.Property.Ssh as Ssh import qualified Propellor.Property.Git as Git +import qualified Propellor.Property.Cron as Cron import qualified Propellor.Property.Service as Service import qualified Propellor.Property.User as User import qualified Propellor.Property.Obnam as Obnam @@ -189,6 +190,7 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" , File.ownerGroup d "joey" "joey" ] +-- Twitter, you kill us. twitRss :: Property twitRss = combineProperties "twitter rss" [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing @@ -203,6 +205,11 @@ twitRss = combineProperties "twitter rss" , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] + , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter.rss" + , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep.rss" ] where dir = "/srv/web/tmp.kitenet.net/twitrss" + crontime = "15 * * * *" + feed url file = Cron.job "twitter rss cron job" crontime "joey" dir $ + "./twitRss " ++ shellEscape url ++ " > ../" ++ shellEscape file -- cgit v1.2.3 From 723af9c5f24bf91d01a79a1b5365c0db570784f8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:55:03 -0400 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index d52ddbb3..ae6c2dc4 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -205,11 +205,11 @@ twitRss = combineProperties "twitter rss" , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] - , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter.rss" - , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep.rss" + , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter" + , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep" ] where dir = "/srv/web/tmp.kitenet.net/twitrss" crontime = "15 * * * *" - feed url file = Cron.job "twitter rss cron job" crontime "joey" dir $ - "./twitRss " ++ shellEscape url ++ " > ../" ++ shellEscape file + feed url desc = Cron.job desc crontime "joey" dir $ + "./twitRss " ++ shellEscape url ++ " > " ++ shellEscape ("../" ++ desc ++ ".rss") -- cgit v1.2.3 From 0b5c5f7c9a4e9b192237669903e954eae84dafd0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:17:31 -0400 Subject: propellor spin --- Propellor/Property/Hostname.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 03613ac9..59aade45 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -4,11 +4,12 @@ import Propellor import qualified Propellor.Property.File as File -- | Ensures that the hostname is set to the HostAttr value. --- Configures both /etc/hostname and the current hostname. +-- Configures /etc/hostname and the current hostname. -- --- When the hostname is a FQDN, also configures /etc/hosts, --- with an entry for 127.0.1.1, which is standard at least on Debian --- to set the FDQN (127.0.0.1 is localhost). +-- When the hostname is a FQDN, also configures /etc/mailname +-- with the domain part. +-- A FQDN also configures /etc/hosts, with an entry for 127.0.1.1, which is +-- standard at least on Debian to set the FDQN (127.0.0.1 is localhost). sane :: Property sane = Property ("sane hostname") (ensureProperty . setTo =<< getHostName) @@ -25,6 +26,9 @@ setTo hn = combineProperties desc go then Nothing else Just $ File.fileProperty desc addhostline "/etc/hosts" + , if null domain + then Nothing + else Just $ "/etc/mailname" `File.hasContent` [domain] ] hostip = "127.0.1.1" -- cgit v1.2.3 From 8bb029002e547f272e705d92dbc9c4fa53a63d78 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:35:29 -0400 Subject: propellor spin --- Propellor/Property/Postfix.hs | 26 ++++++++++++++++++++++++++ config-joey.hs | 7 +++++-- propellor.cabal | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Propellor/Property/Postfix.hs (limited to 'Propellor') diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs new file mode 100644 index 00000000..c253aac2 --- /dev/null +++ b/Propellor/Property/Postfix.hs @@ -0,0 +1,26 @@ +module Propellor.Property.Postfix where + +import Propellor +import qualified Propellor.Property.Apt as Apt +import Propellor.Property.User +import Utility.SafeCommand +import Utility.FileMode + +import System.PosixCompat + +installed :: Property +installed = Apt.serviceInstalledRunning "postfix" + +-- | Configures postfix as a satellite system, which +-- relats all mail through a relay host, which defaults to smtp.domain. +-- +-- The smarthost may refuse to relay mail on to other domains, without +-- futher coniguration/keys. But this should be enough to get cron job +-- mail flowing to a place where it will be seen. +satellite :: Property +satellite = Apt.reConfigure "postfix" + [ ("postfix/main_mailer_type", "select", "Satellite system") + , ("postfix/destinations", "string", "") + ] + `describe` "postfix satellite system" + `requires` installed diff --git a/config-joey.hs b/config-joey.hs index 00c811d2..6039a529 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -18,6 +18,7 @@ import qualified Propellor.Property.OpenId as OpenId import qualified Propellor.Property.Docker as Docker import qualified Propellor.Property.Git as Git import qualified Propellor.Property.Apache as Apache +import qualified Propellor.Property.Postfix as Postfix import qualified Propellor.Property.SiteSpecific.GitHome as GitHome import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites @@ -40,7 +41,9 @@ hosts = -- (o) ` & Apt.unattendedUpgrades & Network.ipv6to4 & Tor.isBridge + & Postfix.satellite & Docker.configured + & cname "shell.olduse.net" & JoeySites.oldUseNetShellBox @@ -62,6 +65,7 @@ hosts = -- (o) ` , standardSystem "orca.kitenet.net" Unstable "amd64" & Hostname.sane & Apt.unattendedUpgrades + & Postfix.satellite & Docker.configured & Docker.docked hosts "amd64-git-annex-builder" & Docker.docked hosts "i386-git-annex-builder" @@ -79,8 +83,7 @@ hosts = -- (o) ` & Apt.unattendedUpgrades & Apt.serviceInstalledRunning "ntp" & Dns.zones myDnsSecondary - - & Apt.serviceInstalledRunning "postfix" + & Postfix.satellite & Apt.serviceInstalledRunning "apache2" & File.hasPrivContent "/etc/ssl/certs/web.pem" diff --git a/propellor.cabal b/propellor.cabal index 1d625381..482f2de6 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -81,6 +81,7 @@ Library Propellor.Property.Network Propellor.Property.Obnam Propellor.Property.OpenId + Propellor.Property.Postfix Propellor.Property.Reboot Propellor.Property.Scheduled Propellor.Property.Service -- cgit v1.2.3 From e8db2577a8e07deda5ad121f7a574e2f4d88c543 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:42:26 -0400 Subject: propellor spin --- Propellor/Property/Hostname.hs | 5 ----- Propellor/Property/Postfix.hs | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 59aade45..30e0992d 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -6,8 +6,6 @@ import qualified Propellor.Property.File as File -- | Ensures that the hostname is set to the HostAttr value. -- Configures /etc/hostname and the current hostname. -- --- When the hostname is a FQDN, also configures /etc/mailname --- with the domain part. -- A FQDN also configures /etc/hosts, with an entry for 127.0.1.1, which is -- standard at least on Debian to set the FDQN (127.0.0.1 is localhost). sane :: Property @@ -26,9 +24,6 @@ setTo hn = combineProperties desc go then Nothing else Just $ File.fileProperty desc addhostline "/etc/hosts" - , if null domain - then Nothing - else Just $ "/etc/mailname" `File.hasContent` [domain] ] hostip = "127.0.1.1" diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs index c253aac2..49676640 100644 --- a/Propellor/Property/Postfix.hs +++ b/Propellor/Property/Postfix.hs @@ -2,11 +2,6 @@ module Propellor.Property.Postfix where import Propellor import qualified Propellor.Property.Apt as Apt -import Propellor.Property.User -import Utility.SafeCommand -import Utility.FileMode - -import System.PosixCompat installed :: Property installed = Apt.serviceInstalledRunning "postfix" @@ -18,9 +13,13 @@ installed = Apt.serviceInstalledRunning "postfix" -- futher coniguration/keys. But this should be enough to get cron job -- mail flowing to a place where it will be seen. satellite :: Property -satellite = Apt.reConfigure "postfix" - [ ("postfix/main_mailer_type", "select", "Satellite system") - , ("postfix/destinations", "string", "") - ] - `describe` "postfix satellite system" - `requires` installed +satellite = setup `requires` installed + where + setup = Property "postfix satellite system" $ do + hn <- getHostName + ensureProperty $ Apt.reConfigure "postfix" + [ ("postfix/main_mailer_type", "select", "Satellite system") + , ("postfix/root_address", "string", "root") + , ("postfix/destinations", "string", " ") + , ("postfix/mailname", "string", hn) + ] -- cgit v1.2.3 From 1f2c68d595bbe5591517f44cdaa9ffd7ce1e00bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 16:01:17 -0400 Subject: propellor spin --- Propellor/Property/Apt.hs | 12 +++++++----- Propellor/Property/Postfix.hs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index a01ab3cc..2aeeab74 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -5,6 +5,7 @@ import Control.Applicative import Data.List import System.IO import Control.Monad +import System.Process (env) import Propellor import qualified Propellor.Property.File as File @@ -195,12 +196,13 @@ reConfigure package vals = reconfigure `requires` setselections `describe` ("reconfigure " ++ package) where setselections = Property "preseed" $ makeChange $ - withHandle StdinHandle createProcessSuccess - (proc "debconf-set-selections" []) $ \h -> do - forM_ vals $ \(tmpl, tmpltype, value) -> - hPutStrLn h $ unwords [package, tmpl, tmpltype, value] - hClose h + withHandle StdinHandle createProcessSuccess p $ \h -> do + forM_ vals $ \(tmpl, tmpltype, value) -> + hPutStrLn h $ unwords [package, tmpl, tmpltype, value] + hClose h reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package] + p = (proc "debconf-set-selections" []) + { env = Just noninteractiveEnv } -- | Ensures that a service is installed and running. -- diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs index 49676640..f4be27cf 100644 --- a/Propellor/Property/Postfix.hs +++ b/Propellor/Property/Postfix.hs @@ -15,7 +15,7 @@ installed = Apt.serviceInstalledRunning "postfix" satellite :: Property satellite = setup `requires` installed where - setup = Property "postfix satellite system" $ do + setup = trivial $ Property "postfix satellite system" $ do hn <- getHostName ensureProperty $ Apt.reConfigure "postfix" [ ("postfix/main_mailer_type", "select", "Satellite system") -- cgit v1.2.3 From a83d48927044145bd7298984c36ffd16ffdbc6bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 16:02:48 -0400 Subject: propellor spin --- Propellor/Property/Apt.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index 2aeeab74..3842cb02 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -5,7 +5,6 @@ import Control.Applicative import Data.List import System.IO import Control.Monad -import System.Process (env) import Propellor import qualified Propellor.Property.File as File @@ -196,13 +195,12 @@ reConfigure package vals = reconfigure `requires` setselections `describe` ("reconfigure " ++ package) where setselections = Property "preseed" $ makeChange $ - withHandle StdinHandle createProcessSuccess p $ \h -> do - forM_ vals $ \(tmpl, tmpltype, value) -> - hPutStrLn h $ unwords [package, tmpl, tmpltype, value] - hClose h - reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package] - p = (proc "debconf-set-selections" []) - { env = Just noninteractiveEnv } + withHandle StdinHandle createProcessSuccess + (proc "debconf-set-selections" []) $ \h -> do + forM_ vals $ \(tmpl, tmpltype, value) -> + hPutStrLn h $ unwords [package, tmpl, tmpltype, value] + hClose h + reconfigure = cmdProperty' "dpkg-reconfigure" ["-fnone", package] noninteractiveEnv -- | Ensures that a service is installed and running. -- -- cgit v1.2.3 From 0592ab4bd7deaadaa971bc7d19b7beaca5a1253e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Apr 2014 15:08:25 -0400 Subject: since http conduit is broken on stable, go ghetto and use curl --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 - config-joey.hs | 1 - 2 files changed, 2 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index ae6c2dc4..dd24bb6c 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -202,7 +202,6 @@ twitRss = combineProperties "twitter rss" `requires` Apt.installed [ "libghc-xml-dev" , "libghc-feed-dev" - , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter" diff --git a/config-joey.hs b/config-joey.hs index 30f46ea9..6039a529 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -109,7 +109,6 @@ hosts = -- (o) ` "tmp.kitenet.net" "26fd6e38-1226-11e2-a75f-ff007033bdba" [] - -- TODO:twitRss is broken on stable & JoeySites.twitRss & Apt.installed ["ntop"] -- cgit v1.2.3