summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Parted.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-03 07:21:49 -0700
committerJoey Hess2015-09-03 07:21:49 -0700
commit55b925a6e0e5a27a964d9b80cd64d519cda7ae3d (patch)
tree645c0508b359cfddacc6ce9286e1a3aa9846cf75 /src/Propellor/Property/Parted.hs
parent00ce4591aacfc2c16d8a3204ebd5dd0fc52d5825 (diff)
partition setup dsl
Diffstat (limited to 'src/Propellor/Property/Parted.hs')
-rw-r--r--src/Propellor/Property/Parted.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs
index 0b77fad1..a4f0f98e 100644
--- a/src/Propellor/Property/Parted.hs
+++ b/src/Propellor/Property/Parted.hs
@@ -93,7 +93,11 @@ newtype PartSize = MegaBytes Integer
deriving (Show)
instance PartedVal PartSize where
- val (MegaBytes n) = show n ++ "MB"
+ val (MegaBytes n)
+ | n > 0 = show n ++ "MB"
+ -- parted can't make partitions smaller than 1MB;
+ -- avoid failure in edge cases
+ | otherwise = show "1MB"
-- | Rounds up to the nearest MegaByte.
toPartSize :: ByteSize -> PartSize