summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorrsiddharth2018-06-24 13:48:24 +0000
committerJoey Hess2018-06-24 11:20:16 -0400
commit7c55455944e94d2d88f1f5bebf940c3cba0c2417 (patch)
treea58a36bcf332e2ff195e5effb2c77ff2255cf4c7 /src/Propellor
parent5f6e3fc68cf78ddce8ec93601c49714dec1a382b (diff)
update rValue of Dns TXT record type
The TXT record's string is split into strings of length <= 255 characters and these strings are enclosed inside a pair of parentheses. Signed-off-by: rsiddharth <s@ricketyspace.net>
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Property/Dns.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs
index d99a76b0..c89ce271 100644
--- a/src/Propellor/Property/Dns.hs
+++ b/src/Propellor/Property/Dns.hs
@@ -26,6 +26,7 @@ import Utility.Applicative
import qualified Data.Map as M
import qualified Data.Set as S
+import qualified Data.List.Split as Split (chunksOf)
import Data.List
-- | Primary dns server for a domain, using bind.
@@ -321,8 +322,15 @@ rValue (SSHFP x y s) = Just $ unwords
, s
]
rValue (INCLUDE f) = Just f
-rValue (TXT s) = Just $ [q] ++ filter (/= q) s ++ [q]
+rValue (TXT s) = Just $ [op] ++ [w]
+ ++ (intercalate "\n\t" $
+ map (\x -> [q] ++ filter (/= q) x ++ [q]) $
+ Split.chunksOf 255 s)
+ ++ [w] ++ [cp]
where
+ op = '('
+ cp = ')'
+ w = ' '
q = '"'
rValue (PTR _) = Nothing