summaryrefslogtreecommitdiff
path: root/src/Propellor/Types
diff options
context:
space:
mode:
authorDaniel Brooks2015-08-02 00:59:28 -0400
committerDaniel Brooks2015-08-02 00:59:28 -0400
commiteb15f06896aeb208d19f6f322905c7782125356e (patch)
tree6f28ac50e476e83b212e2827a10d4b6dee0730c9 /src/Propellor/Types
parent65b511e2d4f4ec9864167e414e76b967eda32dba (diff)
parentb7a9655a695103b3ca2e4e6edfe305f9b44d9250 (diff)
Merge branch 'joeyconfig' of git://git.kitenet.net/propellor into joeyconfig
Conflicts: src/Propellor/Property/SiteSpecific/IABak.hs
Diffstat (limited to 'src/Propellor/Types')
-rw-r--r--src/Propellor/Types/CmdLine.hs1
-rw-r--r--src/Propellor/Types/Container.hs30
-rw-r--r--src/Propellor/Types/OS.hs4
3 files changed, 35 insertions, 0 deletions
diff --git a/src/Propellor/Types/CmdLine.hs b/src/Propellor/Types/CmdLine.hs
index bd0cbdfd..96949957 100644
--- a/src/Propellor/Types/CmdLine.hs
+++ b/src/Propellor/Types/CmdLine.hs
@@ -10,6 +10,7 @@ data CmdLine
| Spin [HostName] (Maybe HostName)
| SimpleRun HostName
| Set PrivDataField Context
+ | Unset PrivDataField Context
| Dump PrivDataField Context
| Edit PrivDataField Context
| ListFields
diff --git a/src/Propellor/Types/Container.hs b/src/Propellor/Types/Container.hs
new file mode 100644
index 00000000..d21bada7
--- /dev/null
+++ b/src/Propellor/Types/Container.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module Propellor.Types.Container where
+
+-- | A value that can be bound between the host and a container.
+--
+-- For example, a Bound Port is a Port on the container that is bound to
+-- a Port on the host.
+data Bound v = Bound
+ { hostSide :: v
+ , containerSide :: v
+ }
+
+-- | Create a Bound value, from two different values for the host and
+-- container.
+--
+-- For example, @Port 8080 -<- Port 80@ means that port 8080 on the host
+-- is bound to port 80 from the container.
+(-<-) :: (hostv ~ v, containerv ~ v) => hostv -> containerv -> Bound v
+(-<-) hostv containerv = Bound hostv containerv
+
+-- | Flipped version of -<- with the container value first and host value
+-- second.
+(->-) :: (containerv ~ v, hostv ~ v) => hostv -> containerv -> Bound v
+(->-) containerv hostv = Bound hostv containerv
+
+-- | Create a Bound value, that is the same on both the host and container.
+same :: v -> Bound v
+same v = Bound v v
+
diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs
index 58bd809a..c46d9a28 100644
--- a/src/Propellor/Types/OS.hs
+++ b/src/Propellor/Types/OS.hs
@@ -10,6 +10,7 @@ module Propellor.Types.OS (
User(..),
Group(..),
userGroup,
+ Port(..),
) where
import Network.BSD (HostName)
@@ -42,3 +43,6 @@ newtype Group = Group String
-- | Makes a Group with the same name as the User.
userGroup :: User -> Group
userGroup (User u) = Group u
+
+newtype Port = Port Int
+ deriving (Eq, Show)