summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Aiccu.hs
diff options
context:
space:
mode:
authorJelmer Vernooij2015-09-20 14:25:37 +0000
committerJoey Hess2015-09-20 14:30:49 -0400
commit266fbe7f20dbefc4709b323bc316f4ae33206ec6 (patch)
tree87a75b054e8f8506be4a93139753b18f3928323e /src/Propellor/Property/Aiccu.hs
parent75556f0a093bee38575da56f2422b9821c4897f0 (diff)
Add aiccu module.
Diffstat (limited to 'src/Propellor/Property/Aiccu.hs')
-rw-r--r--src/Propellor/Property/Aiccu.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Propellor/Property/Aiccu.hs b/src/Propellor/Property/Aiccu.hs
new file mode 100644
index 00000000..c6c1569a
--- /dev/null
+++ b/src/Propellor/Property/Aiccu.hs
@@ -0,0 +1,27 @@
+module Propellor.Property.Aiccu where
+
+import Propellor
+import qualified Propellor.Property.Apt as Apt
+
+confPath :: FilePath
+confPath = "/etc/aiccu.conf"
+
+config :: String -> String -> PrivData -> [String]
+config u t p = [ "protocol tic"
+ , "server tic.sixxs.net"
+ , "username " ++ u
+ , "password " ++ (privDataVal p)
+ , "ipv6_interface sixxs"
+ , "tunnel_id " ++ t
+ , "daemonize true"
+ , "automatic true"
+ , "requiretls true"
+ , "makebeats true"
+ ]
+
+hasConfig :: String -> String -> Property HasInfo
+hasConfig t u = withSomePrivData [(Password (u++"/"++t)), (Password u)] (Context "aiccu") $ property "aiccu configured" . writeConfig
+ where writeConfig :: (((PrivDataField, PrivData) -> Propellor Result) -> Propellor Result) -> Propellor Result
+ writeConfig getpassword = getpassword $ go
+ go (Password u, p) = makeChange $ writeFile confPath (unlines $ config u t p)
+ go (f, _) = error $ "Unexpected type of privdata: " ++ show f