summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Logcheck.hs
diff options
context:
space:
mode:
authorJoey Hess2017-02-26 16:11:38 -0400
committerJoey Hess2017-02-26 16:17:19 -0400
commit55ed8e8743e861e2230e40670a56034353cf4e32 (patch)
tree3e5f8a965569f1dcf8a7c3cabd10e663924208dd /src/Propellor/Property/Logcheck.hs
parent2ba4b6fb3d29b2b65aa60f4bd591ed8cf6a63e27 (diff)
use ConfigurableValue where applicable
* Removed fromPort (use val instead). (API change) * Removed several Show instances that were only used for generating configuration, replacing with ConfigurableValue instances. (API change) It's somewhat annoying that IsInfo requires a Show instance. That's needed to be able to display Info in ghci, but some non-derived Show instances had to be kept to support that.
Diffstat (limited to 'src/Propellor/Property/Logcheck.hs')
-rw-r--r--src/Propellor/Property/Logcheck.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Propellor/Property/Logcheck.hs b/src/Propellor/Property/Logcheck.hs
index ced9fce2..8eaf56fd 100644
--- a/src/Propellor/Property/Logcheck.hs
+++ b/src/Propellor/Property/Logcheck.hs
@@ -16,21 +16,21 @@ import qualified Propellor.Property.File as File
data ReportLevel = Workstation | Server | Paranoid
type Service = String
-instance Show ReportLevel where
- show Workstation = "workstation"
- show Server = "server"
- show Paranoid = "paranoid"
+instance ConfigurableValue ReportLevel where
+ val Workstation = "workstation"
+ val Server = "server"
+ val Paranoid = "paranoid"
-- The common prefix used by default in syslog lines.
defaultPrefix :: String
defaultPrefix = "^\\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ "
ignoreFilePath :: ReportLevel -> Service -> FilePath
-ignoreFilePath t n = "/etc/logcheck/ignore.d." ++ (show t) </> n
+ignoreFilePath t n = "/etc/logcheck/ignore.d." ++ (val t) </> n
ignoreLines :: ReportLevel -> Service -> [String] -> Property UnixLike
ignoreLines t n ls = (ignoreFilePath t n) `File.containsLines` ls
- `describe` ("logcheck ignore lines for " ++ n ++ "(" ++ (show t) ++ ")")
+ `describe` ("logcheck ignore lines for " ++ n ++ "(" ++ val t ++ ")")
installed :: Property DebianLike
installed = Apt.installed ["logcheck"]