diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-12-05 17:52:43 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-12-05 17:53:16 -0400 |
| commit | 12548bae3d8feecce6a322162d91b827289ae824 (patch) | |
| tree | 45f5ec5131817aab5133c9c1e4dbcf3364953e76 /src/Propellor/Property/Locale.hs | |
| parent | b816e40e2618a8932144bceb7c7039adc5c44c11 (diff) | |
UncheckedProperty for cmdProperty et al
* Properties that run an arbitrary command, such as cmdProperty
and scriptProperty are converted to use UncheckedProperty, since
they cannot tell on their own if the command truely made a change or not.
(API Change)
Transition guide:
- When GHC complains about an UncheckedProperty, add:
`assume` MadeChange
- Since these properties used to always return MadeChange, that
change is always safe to make.
- Or, if you know that the command should modifiy a file, use:
`changesFile` filename
* A few properties have had their Result improved, for example
Apt.buldDep and Apt.autoRemove now check if a change was made or not.
Diffstat (limited to 'src/Propellor/Property/Locale.hs')
| -rw-r--r-- | src/Propellor/Property/Locale.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Propellor/Property/Locale.hs b/src/Propellor/Property/Locale.hs index c1040780..0342a2f2 100644 --- a/src/Propellor/Property/Locale.hs +++ b/src/Propellor/Property/Locale.hs @@ -24,12 +24,12 @@ type LocaleVariable = String selectedFor :: Locale -> [LocaleVariable] -> RevertableProperty NoInfo locale `selectedFor` vars = select <!> deselect where - select = - trivial $ cmdProperty "update-locale" selectArgs + select = cmdProperty "update-locale" selectArgs + `assume` NoChange `requires` available locale `describe` (locale ++ " locale selected") - deselect = - trivial $ cmdProperty "update-locale" vars + deselect = cmdProperty "update-locale" vars + `assume` NoChange `describe` (locale ++ " locale deselected") selectArgs = zipWith (++) vars (repeat ('=':locale)) @@ -70,4 +70,6 @@ available locale = (ensureAvailable <!> ensureUnavailable) l `presentIn` ls = any (l `isPrefix`) ls l `isPrefix` x = (l `isPrefixOf` x) || (("# " ++ l) `isPrefixOf` x) - regenerate = cmdProperty "dpkg-reconfigure" ["-f", "noninteractive", "locales"] + regenerate = cmdProperty "dpkg-reconfigure" + ["-f", "noninteractive", "locales"] + `assume` MadeChange |
