From 7c4b1537391d801855e28a61c896efcc70cfaa81 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 21:18:36 -0400 Subject: simplify monoid instance with some helper types --- src/Propellor/Attr.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Propellor/Attr.hs') diff --git a/src/Propellor/Attr.hs b/src/Propellor/Attr.hs index 29d7a01e..3ed59437 100644 --- a/src/Propellor/Attr.hs +++ b/src/Propellor/Attr.hs @@ -15,12 +15,15 @@ import Control.Applicative pureAttrProperty :: Desc -> Attr -> Property pureAttrProperty desc = Property ("has " ++ desc) (return NoChange) +askAttr :: (Attr -> Val a) -> Propellor (Maybe a) +askAttr f = asks (fromVal . f . hostAttr) + os :: System -> Property os system = pureAttrProperty ("Operating " ++ show system) $ - mempty { _os = Just system } + mempty { _os = Val system } getOS :: Propellor (Maybe System) -getOS = asks (_os . hostAttr) +getOS = askAttr _os -- | Indidate that a host has an A record in the DNS. -- @@ -55,10 +58,10 @@ addDNS r = pureAttrProperty (rdesc r) $ sshPubKey :: String -> Property sshPubKey k = pureAttrProperty ("ssh pubkey known") $ - mempty { _sshPubKey = Just k } + mempty { _sshPubKey = Val k } getSshPubKey :: Propellor (Maybe String) -getSshPubKey = asks (_sshPubKey . hostAttr) +getSshPubKey = askAttr _sshPubKey hostMap :: [Host] -> M.Map HostName Host hostMap l = M.fromList $ zip (map hostName l) l -- cgit v1.3-2-g0d8e From d224463dcd45b798c532d75ed84d9b1282b83e85 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 15:07:17 -0400 Subject: comment --- config-joey.hs | 4 +++- debian/changelog | 2 +- src/Propellor/Attr.hs | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Attr.hs') diff --git a/config-joey.hs b/config-joey.hs index de4ad815..2f2ffa03 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -37,8 +37,9 @@ hosts = -- (o) ` -- My laptop [ host "darkstar.kitenet.net" & ipv6 "2001:4830:1600:187::2" -- sixxs tunnel - & Docker.configured + & Apt.buildDep ["git-annex"] `period` Daily + & Docker.configured & Docker.docked hosts "android-git-annex" -- Nothing super-important lives here and mostly it's docker containers. @@ -165,6 +166,7 @@ hosts = -- (o) ` -- storage and backup server , standardSystem "elephant.kitenet.net" Unstable "amd64" & ipv4 "193.234.225.114" + & Hostname.sane & Postfix.satellite & Apt.unattendedUpgrades diff --git a/debian/changelog b/debian/changelog index 695ea3fc..0f32b4eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ propellor (0.6.0) UNRELEASED; urgency=medium * Docker containers now propigate DNS attributes out to the host they're docked in. So if a docker container sets a DNS alias, every container - it's docked in will automatically become part of a round-robin DNS, + it's docked in will automatically be added to a DNS round-robin, if propellor is used to manage DNS for the domain. * Propellor's output now includes the hostname being provisioned, or when provisioning a docker container, the container name. diff --git a/src/Propellor/Attr.hs b/src/Propellor/Attr.hs index 3ed59437..7d371d40 100644 --- a/src/Propellor/Attr.hs +++ b/src/Propellor/Attr.hs @@ -37,6 +37,11 @@ ipv6 :: String -> Property ipv6 = addDNS . Address . IPv6 -- | Indicates another name for the host in the DNS. +-- +-- When the host's ipv4/ipv6 addresses are known, the alias is set up +-- to use their address, rather than using a CNAME. This avoids various +-- problems with CNAMEs, and also means that when multiple hosts have the +-- same alias, a DNS round-robin is automatically set up. alias :: Domain -> Property alias = addDNS . CNAME . AbsDomain -- cgit v1.3-2-g0d8e