Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
aff363a4
Commit
aff363a4
authored
May 19, 2009
by
Iustin Pop
Browse files
Drop RAPI v1 compatiblity
Since we only support Ganeti 2.0, we drop the 1.2 compatibility.
parent
00b15752
Changes
1
Hide whitespace changes
Inline
Side-by-side
Ganeti/HTools/Rapi.hs
View file @
aff363a4
...
...
@@ -33,37 +33,23 @@ getUrl url = do
_
->
Left
$
printf
"Curl error for '%s', error %s"
url
(
show
code
))
tryRapi
::
String
->
String
->
IO
(
Either
String
String
)
tryRapi
url1
url2
=
do
body1
<-
getUrl
url1
(
case
body1
of
Left
_
->
getUrl
url2
Right
_
->
return
body1
)
getInstances
::
String
->
IO
(
Either
String
String
)
getInstances
master
=
let
url2
=
printf
"https://%s:5080/2/instances?bulk=1"
master
url1
=
printf
"http://%s:5080/instances?bulk=1"
master
in
do
body
<-
tryRapi
url1
url2
let
inst
=
body
`
combineEithers
`
loadJSArray
`
combineEithers
`
(
parseEitherList
parseInstance
)
return
inst
getInstances
master
=
do
let
url2
=
printf
"https://%s:5080/2/instances?bulk=1"
master
body
<-
getUrl
url2
let
inst
=
body
`
combineEithers
`
loadJSArray
`
combineEithers
`
(
parseEitherList
parseInstance
)
return
inst
getNodes
::
String
->
IO
(
Either
String
String
)
getNodes
master
=
let
url2
=
printf
"https://%s:5080/2/nodes?bulk=1"
master
url1
=
printf
"http://%s:5080/nodes?bulk=1"
master
in
do
body
<-
tryRapi
url1
url2
let
inst
=
body
`
combineEithers
`
loadJSArray
`
combineEithers
`
(
parseEitherList
parseNode
)
return
inst
getNodes
master
=
do
let
url2
=
printf
"https://%s:5080/2/nodes?bulk=1"
master
body
<-
getUrl
url2
let
inst
=
body
`
combineEithers
`
loadJSArray
`
combineEithers
`
(
parseEitherList
parseNode
)
return
inst
parseInstance
::
JSObject
JSValue
->
Either
String
String
parseInstance
a
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment