diff options
| author | Joey Hess <joey@kitenet.net> | 2014-06-09 01:45:58 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-06-09 01:47:11 -0400 |
| commit | fc49d75e4fb9e8d2c7ce9d60647a26ecc030d253 (patch) | |
| tree | 1652c818d61150ca718986df6474158c9717c5e1 /src/Propellor/Property | |
| parent | 582be8ebe00838509d978091d3c97ebeb1bf99de (diff) | |
Attr is renamed to Info.
Diffstat (limited to 'src/Propellor/Property')
| -rw-r--r-- | src/Propellor/Property/Dns.hs | 26 | ||||
| -rw-r--r-- | src/Propellor/Property/Docker.hs | 32 | ||||
| -rw-r--r-- | src/Propellor/Property/Hostname.hs | 2 |
3 files changed, 30 insertions, 30 deletions
diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs index 50ce649e..ddfcf8e6 100644 --- a/src/Propellor/Property/Dns.hs +++ b/src/Propellor/Property/Dns.hs @@ -15,7 +15,7 @@ module Propellor.Property.Dns ( import Propellor import Propellor.Types.Dns import Propellor.Property.File -import Propellor.Types.Attr +import Propellor.Types.Info import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Service as Service import Utility.Applicative @@ -113,7 +113,7 @@ secondary hosts domain = secondaryFor (otherServers Master hosts domain) hosts d secondaryFor :: [HostName] -> [Host] -> Domain -> RevertableProperty secondaryFor masters hosts domain = RevertableProperty setup cleanup where - setup = pureAttrProperty desc (addNamedConf conf) + setup = pureInfoProperty desc (addNamedConf conf) `requires` servingZones cleanup = namedConfWritten @@ -131,7 +131,7 @@ otherServers :: DnsServerType -> [Host] -> Domain -> [HostName] otherServers wantedtype hosts domain = M.keys $ M.filter wanted $ hostMap hosts where - wanted h = case M.lookup domain (fromNamedConfMap $ _namedconf $ hostAttr h) of + wanted h = case M.lookup domain (fromNamedConfMap $ _namedconf $ hostInfo h) of Nothing -> False Just conf -> confDnsServerType conf == wantedtype && confDomain conf == domain @@ -346,7 +346,7 @@ genZone hosts zdomain soa = inzdomain = M.elems $ M.filterWithKey (\hn _ -> inDomain zdomain $ AbsDomain $ hn) m -- Each host with a hostname located in the zdomain - -- should have 1 or more IPAddrs in its Attr. + -- should have 1 or more IPAddrs in its Info. -- -- If a host lacks any IPAddr, it's probably a misconfiguration, -- so warn. @@ -355,9 +355,9 @@ genZone hosts zdomain soa = | null l = [Left $ "no IP address defined for host " ++ hostName h] | otherwise = map Right l where - attr = hostAttr h + info = hostInfo h l = zip (repeat $ AbsDomain $ hostName h) - (map Address $ getAddresses attr) + (map Address $ getAddresses info) -- Any host, whether its hostname is in the zdomain or not, -- may have cnames which are in the zdomain. The cname may even be @@ -373,10 +373,10 @@ genZone hosts zdomain soa = -- So we can just use the IPAddrs. addcnames :: Host -> [Either WarningMessage (BindDomain, Record)] addcnames h = concatMap gen $ filter (inDomain zdomain) $ - mapMaybe getCNAME $ S.toList (_dns attr) + mapMaybe getCNAME $ S.toList (_dns info) where - attr = hostAttr h - gen c = case getAddresses attr of + info = hostInfo h + gen c = case getAddresses info of [] -> [ret (CNAME c)] l -> map (ret . Address) l where @@ -386,9 +386,9 @@ genZone hosts zdomain soa = hostrecords :: Host -> [Either WarningMessage (BindDomain, Record)] hostrecords h = map Right l where - attr = hostAttr h + info = hostInfo h l = zip (repeat $ AbsDomain $ hostName h) - (S.toList $ S.filter (\r -> isNothing (getIPAddr r) && isNothing (getCNAME r)) (_dns attr)) + (S.toList $ S.filter (\r -> isNothing (getIPAddr r) && isNothing (getCNAME r)) (_dns info)) -- Simplifies the list of hosts. Remove duplicate entries. -- Also, filter out any CHAMES where the same domain has an @@ -417,10 +417,10 @@ domainHost base (AbsDomain d) where dotbase = '.':base -addNamedConf :: NamedConf -> Attr +addNamedConf :: NamedConf -> Info addNamedConf conf = mempty { _namedconf = NamedConfMap (M.singleton domain conf) } where domain = confDomain conf getNamedConf :: Propellor (M.Map Domain NamedConf) -getNamedConf = asks $ fromNamedConfMap . _namedconf . hostAttr +getNamedConf = asks $ fromNamedConfMap . _namedconf . hostInfo diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index fa3e2344..1521eb65 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -35,7 +35,7 @@ module Propellor.Property.Docker ( import Propellor import Propellor.SimpleSh -import Propellor.Types.Attr +import Propellor.Types.Info import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Docker.Shim as Shim @@ -72,9 +72,9 @@ type ContainerName = String -- > & Apt.installed {"apache2"] -- > & ... container :: ContainerName -> Image -> Host -container cn image = Host hn [] attr +container cn image = Host hn [] info where - attr = dockerAttr $ mempty { _dockerImage = Val image } + info = dockerInfo $ mempty { _dockerImage = Val image } hn = cn2hn cn cn2hn :: ContainerName -> HostName @@ -86,8 +86,8 @@ cn2hn cn = cn ++ ".docker" -- The container has its own Properties which are handled by running -- propellor inside the container. -- --- Additionally, the container can have DNS attributes, such as a CNAME. --- These become attributes of the host(s) it's docked in. +-- Additionally, the container can have DNS info, such as a CNAME. +-- These become info of the host(s) it's docked in. -- -- Reverting this property ensures that the container is stopped and -- removed. @@ -96,7 +96,7 @@ docked -> ContainerName -> RevertableProperty docked hosts cn = RevertableProperty - ((maybe id exposeDnsAttrs mhost) (go "docked" setup)) + ((maybe id exposeDnsInfos mhost) (go "docked" setup)) (go "undocked" teardown) where go desc a = property (desc ++ " " ++ cn) $ do @@ -123,9 +123,9 @@ docked hosts cn = RevertableProperty ] ] -exposeDnsAttrs :: Host -> Property -> Property -exposeDnsAttrs (Host _ _ containerattr) p = combineProperties (propertyDesc p) $ - p : map addDNS (S.toList $ _dns containerattr) +exposeDnsInfos :: Host -> Property -> Property +exposeDnsInfos (Host _ _ containerinfo) p = combineProperties (propertyDesc p) $ + p : map addDNS (S.toList $ _dns containerinfo) findContainer :: Maybe Host @@ -144,10 +144,10 @@ findContainer mhost cid cn mk = case mhost of mkContainer :: ContainerId -> Host -> Maybe Container mkContainer cid@(ContainerId hn _cn) h = Container - <$> fromVal (_dockerImage attr) - <*> pure (map (\a -> a hn) (_dockerRunParams attr)) + <$> fromVal (_dockerImage info) + <*> pure (map (\a -> a hn) (_dockerRunParams info)) where - attr = _dockerattr $ hostAttr h' + info = _dockerinfo $ hostInfo h' h' = h -- expose propellor directory inside the container & volume (localdir++":"++localdir) @@ -469,17 +469,17 @@ listImages :: IO [Image] listImages = lines <$> readProcess dockercmd ["images", "--all", "--quiet"] runProp :: String -> RunParam -> Property -runProp field val = pureAttrProperty (param) $ dockerAttr $ +runProp field val = pureInfoProperty (param) $ dockerInfo $ mempty { _dockerRunParams = [\_ -> "--"++param] } where param = field++"="++val genProp :: String -> (HostName -> RunParam) -> Property -genProp field mkval = pureAttrProperty field $ dockerAttr $ +genProp field mkval = pureInfoProperty field $ dockerInfo $ mempty { _dockerRunParams = [\hn -> "--"++field++"=" ++ mkval hn] } -dockerAttr :: DockerAttr -> Attr -dockerAttr a = mempty { _dockerattr = a } +dockerInfo :: DockerInfo -> Info +dockerInfo i = mempty { _dockerinfo = i } -- | The ContainerIdent of a container is written to -- /.propellor-ident inside it. This can be checked to see if diff --git a/src/Propellor/Property/Hostname.hs b/src/Propellor/Property/Hostname.hs index 3a6283cf..10fda040 100644 --- a/src/Propellor/Property/Hostname.hs +++ b/src/Propellor/Property/Hostname.hs @@ -3,7 +3,7 @@ module Propellor.Property.Hostname where import Propellor import qualified Propellor.Property.File as File --- | Ensures that the hostname is set to the HostAttr value. +-- | Ensures that the hostname is set to the HostInfo value. -- Configures /etc/hostname and the current hostname. -- -- A FQDN also configures /etc/hosts, with an entry for 127.0.1.1, which is |
