From 55b925a6e0e5a27a964d9b80cd64d519cda7ae3d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 3 Sep 2015 07:21:49 -0700 Subject: partition setup dsl --- src/Propellor/Property/Parted.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property/Parted.hs') 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 -- cgit v1.3-2-g0d8e