diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:25:30 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:25:30 -0400 |
| commit | c0b502390fd06482500d8298c80a55489198dc9f (patch) | |
| tree | 2b8cd0af28d3df3b82fc5e92fba59f1c0669d036 /src | |
| parent | 506ee8be7638b84588167804f6bbb171f740243f (diff) | |
minor style and layout improvements
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/ZFS/Properties.hs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Propellor/Property/ZFS/Properties.hs b/src/Propellor/Property/ZFS/Properties.hs index 026911ae..5ceaf9ba 100644 --- a/src/Propellor/Property/ZFS/Properties.hs +++ b/src/Propellor/Property/ZFS/Properties.hs @@ -3,8 +3,9 @@ -- Functions defining zfs Properties. module Propellor.Property.ZFS.Properties ( - zfsExists, zfsSetProperties - ) where + zfsExists, + zfsSetProperties +) where import Propellor.Base import Data.List (intercalate) @@ -13,24 +14,23 @@ import qualified Propellor.Property.ZFS.Process as ZP -- | Will ensure that a ZFS volume exists with the specified mount point. -- This requires the pool to exist as well, but we don't create pools yet. zfsExists :: ZFS -> Property NoInfo -zfsExists z = - let - (p, a) = ZP.zfsCommand "create" [Nothing] z - create = cmdProperty p a - in - check (not <$> ZP.zfsExists z) (create) `describe` (unwords ["Creating", zfsName z]) +zfsExists z = check (not <$> ZP.zfsExists z) create + `describe` unwords ["Creating", zfsName z] + where + (p, a) = ZP.zfsCommand "create" [Nothing] z + create = cmdProperty p a -- | Sets the given properties. Returns True if all were successfully changed, False if not. zfsSetProperties :: ZFS -> ZFSProperties -> Property NoInfo -zfsSetProperties z setProperties = - let - spcmd :: String -> String -> (String, [String]) - spcmd p v = ZP.zfsCommand "set" [Just (intercalate "=" [p, v]), Nothing] z +zfsSetProperties z setProperties = setall + `requires` zfsExists z + where + spcmd :: String -> String -> (String, [String]) + spcmd p v = ZP.zfsCommand "set" [Just (intercalate "=" [p, v]), Nothing] z - setprop :: (String, String) -> Property NoInfo - setprop (p, v) = check (ZP.zfsExists z) $ cmdProperty (fst (spcmd p v)) (snd (spcmd p v)) + setprop :: (String, String) -> Property NoInfo + setprop (p, v) = check (ZP.zfsExists z) $ + cmdProperty (fst (spcmd p v)) (snd (spcmd p v)) - setall = combineProperties (unwords ["Setting properties on", zfsName z]) $ - map setprop $ toPropertyList setProperties - in - setall `requires` zfsExists z + setall = combineProperties (unwords ["Setting properties on", zfsName z]) $ + map setprop $ toPropertyList setProperties |
