Workaround xapi bug in Task.GetResult
xapi currently sends us an xmlrpc-encoded string via xmlrpc. This seems to be a bug. Remove this workaround when it's fixed
This commit is contained in:
parent
0cb3aff4e8
commit
fc03c2010f
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/nilshell/xmlrpc"
|
||||
"log"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type XenAPIClient struct {
|
||||
@ -880,10 +881,18 @@ func (self *Task) GetResult() (object *XenAPIObject, err error) {
|
||||
}
|
||||
switch ref := result.Value.(type) {
|
||||
case string:
|
||||
// @fixme: xapi currently sends us an xmlrpc-encoded string via xmlrpc.
|
||||
// This seems to be a bug in xapi. Remove this workaround when it's fixed
|
||||
re := regexp.MustCompile("^<value><array><data><value>([^<]*)</value>.*</data></array></value>$")
|
||||
match := re.FindStringSubmatch(ref)
|
||||
if match == nil {
|
||||
object = nil
|
||||
} else {
|
||||
object = &XenAPIObject{
|
||||
Ref: ref.(string),
|
||||
Ref: match[1],
|
||||
Client: self.Client,
|
||||
}
|
||||
}
|
||||
case nil:
|
||||
object = nil
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user