summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-04-03 02:27:17 -0400
committerJoey Hess2014-04-03 02:27:17 -0400
commitfdb48b1dd11b802d0c2124fb3833672ca87ab870 (patch)
tree6537cfb4d2211eaf478411ca95cec56dbe706bcc
parent9a9f249ff0cfe2b5f601c84368457245ddb4d78b (diff)
api doc improvements
-rw-r--r--Propellor/Property/Apt.hs13
-rw-r--r--Propellor/Property/Cmd.hs2
-rw-r--r--Propellor/Property/File.hs2
-rw-r--r--Propellor/Property/Network.hs4
-rw-r--r--Propellor/Property/Ssh.hs14
-rw-r--r--Propellor/Property/Sudo.hs8
-rw-r--r--propellor.cabal4
7 files changed, 27 insertions, 20 deletions
diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs
index d3c5044a..8bbb1b19 100644
--- a/Propellor/Property/Apt.hs
+++ b/Propellor/Property/Apt.hs
@@ -46,12 +46,11 @@ debCdn = binandsrc "http://cdn.debian.net/debian"
kernelOrg :: DebianSuite -> [Line]
kernelOrg = binandsrc "http://mirrors.kernel.org/debian"
-{- | Makes sources.list have a standard content using the mirror CDN,
- - with a particular DebianSuite.
- -
- - Since the CDN is sometimes unreliable, also adds backup lines using
- - kernel.org.
- -}
+-- | Makes sources.list have a standard content using the mirror CDN,
+-- with a particular DebianSuite.
+--
+-- Since the CDN is sometimes unreliable, also adds backup lines using
+-- kernel.org.
stdSourcesList :: DebianSuite -> Property
stdSourcesList suite = setSourcesList (debCdn suite ++ kernelOrg suite)
`describe` ("standard sources.list for " ++ show suite)
@@ -113,7 +112,7 @@ buildDepIn dir = go `requires` installedMin ["devscripts", "equivs"]
noninteractiveEnv
-- | Package installation may fail becuse the archive has changed.
--- Run an update in that case and retry. -}
+-- Run an update in that case and retry.
robustly :: Property -> Property
robustly p = Property (propertyDesc p) $ do
r <- ensureProperty p
diff --git a/Propellor/Property/Cmd.hs b/Propellor/Property/Cmd.hs
index 1f668daf..dc5073d3 100644
--- a/Propellor/Property/Cmd.hs
+++ b/Propellor/Property/Cmd.hs
@@ -41,7 +41,7 @@ scriptProperty script = cmdProperty "sh" ["-c", shellcmd]
shellcmd = intercalate " ; " ("set -e" : script)
-- | A property that can satisfied by running a series of shell commands,
--- as user (staring in their home directory).
+-- as user (cd'd to their home directory).
userScriptProperty :: UserName -> [String] -> Property
userScriptProperty user script = cmdProperty "su" ["-c", shellcmd, user]
where
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 4312b89d..af4f554f 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -19,7 +19,7 @@ f `containsLine` l = fileProperty (f ++ " contains:" ++ l) go f
-- | Ensures that a line is not present in a file.
-- Note that the file is ensured to exist, so if it doesn't, an empty
--- file will be written. -}
+-- file will be written.
lacksLine :: FilePath -> Line -> Property
f `lacksLine` l = fileProperty (f ++ " remove: " ++ l) (filter (/= l)) f
diff --git a/Propellor/Property/Network.hs b/Propellor/Property/Network.hs
index cbef8baa..eae5828f 100644
--- a/Propellor/Property/Network.hs
+++ b/Propellor/Property/Network.hs
@@ -23,5 +23,7 @@ ipv6to4 = fileProperty "ipv6to4" go interfaces
, "# End automatically added by propeller"
]
-ifUp :: String -> Property
+type Interface = String
+
+ifUp :: Interface -> Property
ifUp iface = cmdProperty "ifup" [iface]
diff --git a/Propellor/Property/Ssh.hs b/Propellor/Property/Ssh.hs
index 28fe45f6..36766f56 100644
--- a/Propellor/Property/Ssh.hs
+++ b/Propellor/Property/Ssh.hs
@@ -1,4 +1,11 @@
-module Propellor.Property.Ssh where
+module Propellor.Property.Ssh (
+ setSshdConfig,
+ permitRootLogin,
+ passwordAuthentication,
+ hasAuthorizedKeys,
+ restartSshd,
+ uniqueHostKeys
+) where
import Propellor
import qualified Propellor.Property.File as File
@@ -38,8 +45,9 @@ hasAuthorizedKeys = go <=< homedir
restartSshd :: Property
restartSshd = cmdProperty "service" ["ssh", "restart"]
-{- | Blow away existing host keys and make new ones. Use a flag
- - file to prevent doing this more than once. -}
+-- | Blows away existing host keys and make new ones.
+-- Useful for systems installed from an image that might reuse host keys.
+-- A flag file is used to only ever do this once.
uniqueHostKeys :: Property
uniqueHostKeys = flagFile prop "/etc/ssh/.unique_host_keys"
`onChange` restartSshd
diff --git a/Propellor/Property/Sudo.hs b/Propellor/Property/Sudo.hs
index dbb3e460..68b8d056 100644
--- a/Propellor/Property/Sudo.hs
+++ b/Propellor/Property/Sudo.hs
@@ -7,11 +7,8 @@ import Propellor.Property.File
import qualified Propellor.Property.Apt as Apt
import Propellor.Property.User
-{- | Allows a user to sudo. If the user has a password, sudo is configured
- - to require it. If not, NOPASSWORD is enabled for the user.
- -
- - TOOD: Full sudoers file format parse..
- -}
+-- | Allows a user to sudo. If the user has a password, sudo is configured
+-- to require it. If not, NOPASSWORD is enabled for the user.
enabledFor :: UserName -> Property
enabledFor user = Property desc go `requires` Apt.installed ["sudo"]
where
@@ -26,6 +23,7 @@ enabledFor user = Property desc go `requires` Apt.installed ["sudo"]
sudoline True = sudobaseline ++ " NOPASSWD:ALL"
sudoline False = sudobaseline ++ " ALL"
wanted locked l
+ -- TOOD: Full sudoers file format parse..
| not (sudobaseline `isPrefixOf` l) = True
| "NOPASSWD" `isInfixOf` l = locked
| otherwise = True
diff --git a/propellor.cabal b/propellor.cabal
index 17f48878..c41601f0 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -79,13 +79,13 @@ Library
Propellor.Property.SiteSpecific.GitHome
Propellor.Property.SiteSpecific.JoeySites
Propellor.Property.SiteSpecific.GitAnnexBuilder
- Propellor.CmdLine
Propellor.Message
Propellor.PrivData
Propellor.Engine
- Propellor.SimpleSh
Propellor.Types
Other-Modules:
+ Propellor.CmdLine
+ Propellor.SimpleSh
Utility.Applicative
Utility.Data
Utility.Directory