propellor

propellor config for hosts.
git clone git://git.ricketyspace.net/propellor.git
Log | Files | Refs | LICENSE

commit e7b4a50417c1ce48ea85c26c687635efe126db86
parent 2d558bbdf8c855a5d261ce112c0160f0644ae049
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 17 Jun 2018 16:06:41 +0000

add MTXT record type to Propellor.Types.DNS.Record

MTXT creates a multiline TXT record. It splits the record's text (say
"long string...\n...xyz") at '\n' and creates a TXT record of the
form:

domain IN      TXT     ( "long string..."
        "...xyz" )

Signed-off-by: rsiddharth <s@ricketyspace.net>

Diffstat:
src/Propellor/Property/Dns.hs | 13+++++++++++++
src/Propellor/Property/Unbound.hs | 1+
src/Propellor/Types/Dns.hs | 1+
3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs @@ -23,6 +23,7 @@ import qualified Propellor.Property.Service as Service import Propellor.Property.Scheduled import Propellor.Property.DnsSec import Utility.Applicative +import Utility.Split import qualified Data.Map as M import qualified Data.Set as S @@ -298,6 +299,7 @@ rField (CNAME _) = Just "CNAME" rField (MX _ _) = Just "MX" rField (NS _) = Just "NS" rField (TXT _) = Just "TXT" +rField (MTXT _) = Just "TXT" rField (SRV _ _ _ _) = Just "SRV" rField (SSHFP _ _ _) = Just "SSHFP" rField (INCLUDE _) = Just "$INCLUDE" @@ -324,6 +326,17 @@ rValue (INCLUDE f) = Just f rValue (TXT s) = Just $ [q] ++ filter (/= q) s ++ [q] where q = '"' +rValue (MTXT s) = Just $ [op] ++ [w] + ++ (intercalate "\n\t" $ + map (\x -> [q] ++ filter (/= q) x ++ [q]) $ + splitc n s) + ++ [w] ++ [cp] + where + op = '(' + cp = ')' + w = ' ' + q = '"' + n = '\n' rValue (PTR _) = Nothing -- | Adjusts the serial number of the zone to always be larger diff --git a/src/Propellor/Property/Unbound.hs b/src/Propellor/Property/Unbound.hs @@ -120,6 +120,7 @@ genRecord dom (PTR revip) = Just $ genPTR dom revip genRecord _ (CNAME _) = Nothing genRecord _ (NS _) = Nothing genRecord _ (TXT _) = Nothing +genRecord _ (MTXT _) = Nothing genRecord _ (SRV _ _ _ _) = Nothing genRecord _ (SSHFP _ _ _) = Nothing genRecord _ (INCLUDE _) = Nothing diff --git a/src/Propellor/Types/Dns.hs b/src/Propellor/Types/Dns.hs @@ -113,6 +113,7 @@ data Record | MX Int BindDomain | NS BindDomain | TXT String + | MTXT String | SRV Word16 Word16 Word16 BindDomain | SSHFP Int Int String | INCLUDE FilePath