Revision ea017cbc Ganeti/HTools/Rapi.hs
b/Ganeti/HTools/Rapi.hs | ||
---|---|---|
33 | 33 |
import Network.Curl.Code |
34 | 34 |
import Data.List |
35 | 35 |
import Control.Monad |
36 |
import Text.JSON (JSObject, JSValue, fromJSObject) |
|
36 |
import Text.JSON (JSObject, JSValue, fromJSObject, decodeStrict)
|
|
37 | 37 |
import Text.Printf (printf) |
38 | 38 |
|
39 | 39 |
import Ganeti.HTools.Utils |
... | ... | |
119 | 119 |
let url = formatHost master |
120 | 120 |
node_body <- getUrl $ printf "%s/2/nodes?bulk=1" url |
121 | 121 |
inst_body <- getUrl $ printf "%s/2/instances?bulk=1" url |
122 |
tags_body <- getUrl $ printf "%s/2/tags" url |
|
122 | 123 |
return $ do -- Result monad |
123 | 124 |
node_data <- node_body >>= getNodes |
124 | 125 |
let (node_names, node_idx) = assignIndices node_data |
125 | 126 |
inst_data <- inst_body >>= getInstances node_names |
126 | 127 |
let (_, inst_idx) = assignIndices inst_data |
127 |
return (node_idx, inst_idx, []) |
|
128 |
tags_data <- tags_body >>= (fromJResult . decodeStrict) |
|
129 |
return (node_idx, inst_idx, tags_data) |
Also available in: Unified diff