Commit f5d84060 authored by Michele Tartara's avatar Michele Tartara
Browse files

Prevent LV parser compile error



The LV parser is not compiled correctly by more recent versions of GHC
because of more strict checks.

lvCommand is a surely non-empty list, but the compiler still refuses it
asking for explicitly management of the empty list case.

Instead of managing that case (that would be meaningless), the lvCommand
is split into lvCommand and lvParams, that can be used independently.
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent d90b69f6
......@@ -97,7 +97,8 @@ arguments = [ArgCompletion OptComplFile 0 (Just 0)]
-- | This function computes the JSON representation of the LV status
buildJsonReport :: Maybe FilePath -> IO J.JSValue
buildJsonReport inputFile = do
let (cmd:params) = lvCommand
let cmd = lvCommand
params = lvParams
fromLvs =
((E.try $ readProcess cmd params "") :: IO (Either IOError String)) >>=
exitIfBad "running command" . either (BT.Bad . show) BT.Ok
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
-}
module Ganeti.Storage.Lvm.LVParser (lvParser, lvCommand) where
module Ganeti.Storage.Lvm.LVParser (lvParser, lvCommand, lvParams) where
import Control.Applicative ((<*>), (*>), (<*), (<$>), Applicative, )
import qualified Data.Attoparsec.Text as A
......@@ -70,10 +70,13 @@ stringP =
-- * Parser implementation
-- | The command providing the data, in the format the parser expects
lvCommand :: [String]
lvCommand =
[ "lvs"
, "--noheadings"
lvCommand :: String
lvCommand = "lvs"
-- | The parameters for getting the data in the format the parser expects
lvParams :: [String]
lvParams =
[ "--noheadings"
, "--units", "B"
, "--separator", ";"
, "-o", "lv_uuid,lv_name,lv_attr,lv_major,lv_minor,lv_kernel_major\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment