Structure this correctly.
diff --git a/openstack/compute/v2/servers/requests_test.go b/openstack/compute/v2/servers/requests_test.go
index 5ddea38..7e70707 100644
--- a/openstack/compute/v2/servers/requests_test.go
+++ b/openstack/compute/v2/servers/requests_test.go
@@ -192,5 +192,6 @@
AdminPass: "1234567890",
})
th.AssertNoErr(t, res.Err)
- th.AssertEquals(t, "1234567890", res.AdminPass)
+ adminPass, _ := res.Extract()
+ th.AssertEquals(t, "1234567890", AdminPass)
}
diff --git a/openstack/compute/v2/servers/results.go b/openstack/compute/v2/servers/results.go
index c473450..1bd3bbe 100644
--- a/openstack/compute/v2/servers/results.go
+++ b/openstack/compute/v2/servers/results.go
@@ -57,7 +57,19 @@
// RescueResult represents teh result of a server rescue operation
type RescueResult struct {
ActionResult
- AdminPass string `mapstructure:"adminPass"`
+}
+
+func (r RescueResult) Extract() (string, error) {
+ if r.Err != nil {
+ return nil, r.Err
+ }
+
+ var response struct {
+ AdminPass string `mapstructure:"adminPass"`
+ }
+
+ err := mapstructure.Decode(r.Body, &response)
+ return &response.AdminPass, err
}
// Server exposes only the standard OpenStack fields corresponding to a given server on the user's account.