Revision e015b554
b/Ganeti/HTools/Rapi.hs | ||
---|---|---|
13 | 13 |
import Network.Curl.Code |
14 | 14 |
import Data.Either () |
15 | 15 |
import Data.Maybe |
16 |
import Data.List |
|
16 | 17 |
import Control.Monad |
17 | 18 |
import Text.JSON (JSObject, JSValue) |
18 | 19 |
import Text.Printf (printf) |
... | ... | |
28 | 29 |
_ -> fail $ printf "Curl error for '%s', error %s" |
29 | 30 |
url (show code)) |
30 | 31 |
|
32 |
-- | Append the default port if not passed in |
|
33 |
formatHost :: String -> String |
|
34 |
formatHost master = |
|
35 |
if elem ':' master then master |
|
36 |
else "https://" ++ master ++ ":5080" |
|
37 |
|
|
31 | 38 |
getInstances :: String -> IO (Result String) |
32 | 39 |
getInstances master = do |
33 |
let url2 = printf "https://%s:5080/2/instances?bulk=1" master
|
|
40 |
let url2 = printf "%s/2/instances?bulk=1" (formatHost master)
|
|
34 | 41 |
body <- getUrl url2 |
35 | 42 |
return $ (body >>= \x -> do |
36 | 43 |
arr <- loadJSArray x |
... | ... | |
39 | 46 |
|
40 | 47 |
getNodes :: String -> IO (Result String) |
41 | 48 |
getNodes master = do |
42 |
let url2 = printf "https://%s:5080/2/nodes?bulk=1" master
|
|
49 |
let url2 = printf "%s/2/nodes?bulk=1" (formatHost master)
|
|
43 | 50 |
body <- getUrl url2 |
44 | 51 |
return $ (body >>= \x -> do |
45 | 52 |
arr <- loadJSArray x |
b/hbal.1 | ||
---|---|---|
287 | 287 |
.BI "-m" cluster |
288 | 288 |
Collect data not from files but directly from the |
289 | 289 |
.I cluster |
290 |
given as an argument via RAPI. This work for both Ganeti 1.2 and |
|
291 |
Ganeti 2.0. |
|
290 |
given as an argument via RAPI. If the argument doesn't contain a colon |
|
291 |
(:), then it is converted into a fully-built URL via prepending |
|
292 |
https:// and appending the default RAPI port, otherwise it's |
|
293 |
considered a fully-specified URL and is used unchanged. |
|
292 | 294 |
|
293 | 295 |
.TP |
294 | 296 |
.BI "-l" N ", --max-length=" N |
b/hn1.1 | ||
---|---|---|
232 | 232 |
.BI "-m" cluster |
233 | 233 |
Collect data not from files but directly from the |
234 | 234 |
.I cluster |
235 |
given as an argument via RAPI. This work for both Ganeti 1.2 and |
|
236 |
Ganeti 2.0. |
|
235 |
given as an argument via RAPI. If the argument doesn't contain a colon |
|
236 |
(:), then it is converted into a fully-built URL via prepending |
|
237 |
https:// and appending the default RAPI port, otherwise it's |
|
238 |
considered a fully-specified URL and is used unchanged. |
|
237 | 239 |
|
238 | 240 |
.TP |
239 | 241 |
.BI "-d" DEPTH ", --depth=" DEPTH |
Also available in: Unified diff