summaryrefslogtreecommitdiff
path: root/src/Propellor/Types
diff options
context:
space:
mode:
authorJoey Hess2014-07-06 15:56:56 -0400
committerJoey Hess2014-07-06 15:56:56 -0400
commit58f79c12aad3511b70f2233226d3f0afc5214b10 (patch)
tree3ec92668278f03d9e99c1008d386b6270694a92d /src/Propellor/Types
parent9f781db6daaff6f6cbc8d50d57bea0c188d3a0fa (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Types')
-rw-r--r--src/Propellor/Types/Info.hs5
-rw-r--r--src/Propellor/Types/PrivData.hs34
2 files changed, 38 insertions, 1 deletions
diff --git a/src/Propellor/Types/Info.hs b/src/Propellor/Types/Info.hs
index 5f034492..8856e06f 100644
--- a/src/Propellor/Types/Info.hs
+++ b/src/Propellor/Types/Info.hs
@@ -1,6 +1,7 @@
module Propellor.Types.Info where
import Propellor.Types.OS
+import Propellor.Types.PrivData
import qualified Propellor.Types.Dns as Dns
import qualified Data.Set as S
@@ -9,6 +10,7 @@ import Data.Monoid
-- | Information about a host.
data Info = Info
{ _os :: Val System
+ , _privDataFields :: S.Set (PrivDataField, Context)
, _sshPubKey :: Val String
, _dns :: S.Set Dns.Record
, _namedconf :: Dns.NamedConfMap
@@ -17,9 +19,10 @@ data Info = Info
deriving (Eq, Show)
instance Monoid Info where
- mempty = Info mempty mempty mempty mempty mempty
+ mempty = Info mempty mempty mempty mempty mempty mempty
mappend old new = Info
{ _os = _os old <> _os new
+ , _privDataFields = _privDataFields old <> _privDataFields new
, _sshPubKey = _sshPubKey old <> _sshPubKey new
, _dns = _dns old <> _dns new
, _namedconf = _namedconf old <> _namedconf new
diff --git a/src/Propellor/Types/PrivData.hs b/src/Propellor/Types/PrivData.hs
new file mode 100644
index 00000000..16d6cdb1
--- /dev/null
+++ b/src/Propellor/Types/PrivData.hs
@@ -0,0 +1,34 @@
+module Propellor.Types.PrivData where
+
+import Propellor.Types.OS
+
+-- | Note that removing or changing field names will break the
+-- serialized privdata files, so don't do that!
+-- It's fine to add new fields.
+data PrivDataField
+ = DockerAuthentication
+ | SshPubKey SshKeyType UserName
+ | SshPrivKey SshKeyType UserName
+ | SshAuthorizedKeys UserName
+ | Password UserName
+ | PrivFile FilePath
+ | GpgKey
+ deriving (Read, Show, Ord, Eq)
+
+-- | Context in which a PrivDataField is used.
+--
+-- Often this will be a domain name. For example,
+-- Context "www.example.com" could be used for the SSL cert
+-- for the web server serving that domain. Multiple hosts might
+-- use that privdata.
+newtype Context = Context String
+ deriving (Read, Show, Ord, Eq)
+
+-- | Use when a PrivDataField is not dependent on any paricular context.
+anyContext :: Context
+anyContext = Context "any"
+
+type PrivData = String
+
+data SshKeyType = SshRsa | SshDsa | SshEcdsa | SshEd25519
+ deriving (Read, Show, Ord, Eq)