Replace reflect with type assertion
This commit is contained in:
parent
e6e8855da4
commit
ee0d6d38e0
@ -3,7 +3,6 @@ package xenserver
|
|||||||
import (
|
import (
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
"reflect"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,13 +38,12 @@ func (self *stepWait) Run(state multistep.StateBag) multistep.StepAction {
|
|||||||
// Hack - should encapsulate this in the client really
|
// Hack - should encapsulate this in the client really
|
||||||
// This is needed because we can't guarentee the type
|
// This is needed because we can't guarentee the type
|
||||||
// returned by the xmlrpc lib will be string
|
// returned by the xmlrpc lib will be string
|
||||||
switch reflect.TypeOf(rec["type"]).Kind() {
|
if recType, ok := rec["type"].(string); ok {
|
||||||
case reflect.String:
|
if recType == "CD" {
|
||||||
if rec["type"].(string) == "CD" {
|
|
||||||
ui.Say("Ejecting CD...")
|
ui.Say("Ejecting CD...")
|
||||||
vbd.Eject()
|
vbd.Eject()
|
||||||
}
|
}
|
||||||
default:
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user