From 50cd59cb3e6d20afe48a50fa9dc0c3a9cf9d9960 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Apr 2014 21:09:20 -0400 Subject: new more expressive config.hs WIP --- Propellor/Property/Hostname.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Propellor/Property/Hostname.hs') diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 0708b3ff..03613ac9 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -13,14 +13,14 @@ sane :: Property sane = Property ("sane hostname") (ensureProperty . setTo =<< getHostName) setTo :: HostName -> Property -setTo hostname = combineProperties desc go - `onChange` cmdProperty "hostname" [host] +setTo hn = combineProperties desc go + `onChange` cmdProperty "hostname" [basehost] where - desc = "hostname " ++ hostname - (host, domain) = separate (== '.') hostname + desc = "hostname " ++ hn + (basehost, domain) = separate (== '.') hn go = catMaybes - [ Just $ "/etc/hostname" `File.hasContent` [host] + [ Just $ "/etc/hostname" `File.hasContent` [basehost] , if null domain then Nothing else Just $ File.fileProperty desc @@ -28,7 +28,7 @@ setTo hostname = combineProperties desc go ] hostip = "127.0.1.1" - hostline = hostip ++ "\t" ++ hostname ++ " " ++ host + hostline = hostip ++ "\t" ++ hn ++ " " ++ basehost addhostline ls = hostline : filter (not . hashostip) ls hashostip l = headMaybe (words l) == Just hostip -- cgit v1.2.3