Revision 9f6dcdea Ganeti/HTools/Text.hs
b/Ganeti/HTools/Text.hs | ||
---|---|---|
47 | 47 |
|
48 | 48 |
-- | Safe 'read' function returning data encapsulated in a Result. |
49 | 49 |
tryRead :: (Monad m, Read a) => String -> String -> m a |
50 |
tryRead name s = parseChoices name s $ readsPrec 0 s
|
|
50 |
tryRead name s = parseChoices name s $ reads s |
|
51 | 51 |
|
52 | 52 |
-- | Load a node from a field list. |
53 | 53 |
loadNode :: (Monad m) => [String] -> m (String, Node.Node) |
... | ... | |
64 | 64 |
vtc <- tryRead name tc |
65 | 65 |
return $ Node.create name vtm vnm vfm vtd vfd vtc False |
66 | 66 |
return (name, new_node) |
67 |
loadNode s = fail $ "Invalid/incomplete node data: '" ++ (show s) ++ "'"
|
|
67 |
loadNode s = fail $ "Invalid/incomplete node data: '" ++ show s ++ "'"
|
|
68 | 68 |
|
69 | 69 |
-- | Load an instance from a field list. |
70 | 70 |
loadInst :: (Monad m) => |
... | ... | |
80 | 80 |
" has same primary and secondary node - " ++ pnode |
81 | 81 |
let newinst = Instance.create name vmem vdsk vvcpus status pidx sidx |
82 | 82 |
return (name, newinst) |
83 |
loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ (show s) ++ "'"
|
|
83 |
loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ show s ++ "'"
|
|
84 | 84 |
|
85 | 85 |
-- | Convert newline and delimiter-separated text. |
86 | 86 |
-- |
Also available in: Unified diff