diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-08 16:58:11 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-08 16:58:11 -0400 |
| commit | 0460a04474d2ea4f439708bb9f8ded24fba329ac (patch) | |
| tree | a0e8e90937f2139d0829c540aeadf99ca47526c7 /Propellor | |
| parent | 2e6f7c1b5d04db4841cb748150f2a99dcfba5617 (diff) | |
propellor spin
Diffstat (limited to 'Propellor')
| -rw-r--r-- | Propellor/Property/File.hs | 7 | ||||
| -rw-r--r-- | Propellor/Property/OpenId.hs | 15 | ||||
| -rw-r--r-- | Propellor/Types.hs | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs index 80c69d9b..0c1155fe 100644 --- a/Propellor/Property/File.hs +++ b/Propellor/Property/File.hs @@ -11,6 +11,13 @@ hasContent :: FilePath -> [Line] -> Property f `hasContent` newcontent = fileProperty ("replace " ++ f) (\_oldcontent -> newcontent) f +-- | Ensures a file has contents that comes from PrivData. +-- Note: Does not do anything with the permissions of the file to prevent +-- it from being seen. +hasPrivContent :: FilePath -> Property +hasPrivContent f = Property ("privcontent " ++ f) $ + withPrivData (PrivFile f) (\v -> ensureProperty $ f `hasContent` lines v) + -- | Ensures that a line is present in a file, adding it to the end if not. containsLine :: FilePath -> Line -> Property f `containsLine` l = fileProperty (f ++ " contains:" ++ l) go f diff --git a/Propellor/Property/OpenId.hs b/Propellor/Property/OpenId.hs new file mode 100644 index 00000000..4ebf18f0 --- /dev/null +++ b/Propellor/Property/OpenId.hs @@ -0,0 +1,15 @@ +module Propellor.Property.OpenId where + +import Propellor +import qualified Propellor.Property.File as File +import qualified Propellor.Property.Apt as Apt + +providerFor :: [UserName] -> Property +providerFor users = propertyList ("openid provider") $ + [ serviceRunning "apache2" + `requires` Apt.installed ["apache2"] + , Apt.installed ["simpleid"] + ] ++ map identfile users + where + identfile u = File.hasPrivContent $ concat + [ "/var/lib/simpleid/identities/", u, ".identity" ] diff --git a/Propellor/Types.hs b/Propellor/Types.hs index 52c0c999..856e0ea9 100644 --- a/Propellor/Types.hs +++ b/Propellor/Types.hs @@ -100,6 +100,7 @@ data PrivDataField = DockerAuthentication | SshPrivKey UserName | Password UserName + | PrivFile FilePath deriving (Read, Show, Ord, Eq) |
