mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Add support to Bool type in XMLRPC response
This commit is contained in:
parent
a14db6f7e8
commit
789cc0209b
@ -32,9 +32,10 @@ type oneClient struct {
|
||||
}
|
||||
|
||||
type response struct {
|
||||
status bool
|
||||
body string
|
||||
bodyInt int
|
||||
status bool
|
||||
body string
|
||||
bodyInt int
|
||||
bodyBool bool
|
||||
}
|
||||
|
||||
// Resource implements an OpenNebula Resource methods. *XMLResource implements
|
||||
@ -125,6 +126,7 @@ func (c *oneClient) Call(method string, args ...interface{}) (*response, error)
|
||||
status bool
|
||||
body string
|
||||
bodyInt int64
|
||||
bodyBool bool
|
||||
)
|
||||
|
||||
if c.xmlrpcClientError != nil {
|
||||
@ -152,13 +154,16 @@ func (c *oneClient) Call(method string, args ...interface{}) (*response, error)
|
||||
if ok == false {
|
||||
bodyInt, ok = result[1].(int64)
|
||||
if ok == false {
|
||||
log.Fatal("Unexpected XML-RPC response. Expected: Index 0 Int or String")
|
||||
bodyBool, ok = result[1].(bool)
|
||||
if ok == false {
|
||||
log.Fatal("Unexpected XML-RPC response. Expected: Index 0 Int or String")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: errCode? result[2]
|
||||
|
||||
r := &response{status, body, int(bodyInt)}
|
||||
r := &response{status, body, int(bodyInt), bodyBool}
|
||||
|
||||
if status == false {
|
||||
err = errors.New(body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user