diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-10 17:46:03 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-10 17:46:03 -0400 |
| commit | 2372d6a3f8193145662e393aa61b585d8bafd32d (patch) | |
| tree | 1738d2d20b28a7abd3e9aa5e292ab3fef4b7db12 /Propellor/Property/Hostname.hs | |
| parent | 25942fb0cca0ca90933026bf959506e099ff95a4 (diff) | |
use HostAttr to simplify config file
Diffstat (limited to 'Propellor/Property/Hostname.hs')
| -rw-r--r-- | Propellor/Property/Hostname.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 26635374..0708b3ff 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -3,14 +3,17 @@ module Propellor.Property.Hostname where import Propellor import qualified Propellor.Property.File as File --- | Sets the hostname. Configures both /etc/hostname and the current --- hostname. +-- | Ensures that the hostname is set to the HostAttr value. +-- Configures both /etc/hostname and the current hostname. -- --- When provided with a FQDN, also configures /etc/hosts, +-- 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). -set :: HostName -> Property -set hostname = combineProperties desc go +sane :: Property +sane = Property ("sane hostname") (ensureProperty . setTo =<< getHostName) + +setTo :: HostName -> Property +setTo hostname = combineProperties desc go `onChange` cmdProperty "hostname" [host] where desc = "hostname " ++ hostname |
