api doc improvements

This commit is contained in:
Joey Hess 2014-04-03 02:27:17 -04:00
parent 9a9f249ff0
commit fdb48b1dd1
Failed to extract signature
7 changed files with 27 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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