summaryrefslogtreecommitdiff
path: root/Propellor/Property/Hostname.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-10 21:09:20 -0400
committerJoey Hess2014-04-10 21:13:56 -0400
commit50cd59cb3e6d20afe48a50fa9dc0c3a9cf9d9960 (patch)
treea40995cebd88f276750a3f998124d4d55aaecdba /Propellor/Property/Hostname.hs
parent981085fe8148c23985e1735f0a0926d2efd62375 (diff)
new more expressive config.hs WIP
Diffstat (limited to 'Propellor/Property/Hostname.hs')
-rw-r--r--Propellor/Property/Hostname.hs12
1 files changed, 6 insertions, 6 deletions
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