Fix ListServers to yield full details.
Also, provide ListServersLinksOnly() if you want to retain the older
behavior. LinksOnly variant isn't terribly useful though, as it
provides virtually _no_ useful information other than the mere existence
of a server.
Fixes #45.
diff --git a/acceptance/02-list-servers.go b/acceptance/02-list-servers.go
index 64ec4f6..758c706 100644
--- a/acceptance/02-list-servers.go
+++ b/acceptance/02-list-servers.go
@@ -33,14 +33,47 @@
panic(err)
}
+ tryFullDetails(api)
+ tryLinksOnly(api)
+}
+
+func tryLinksOnly(api gophercloud.CloudServersProvider) {
+ servers, err := api.ListServersLinksOnly()
+ if err != nil {
+ panic(err)
+ }
+
+ if !*quiet {
+ fmt.Println("Id,Name")
+ for _, s := range servers {
+ if s.AccessIPv4 != "" {
+ panic("IPv4 not expected")
+ }
+
+ if s.Status != "" {
+ panic("Status not expected")
+ }
+
+ if s.Progress != 0 {
+ panic("Progress not expected")
+ }
+
+ fmt.Printf("%s,\"%s\"\n", s.Id, s.Name)
+ }
+ }
+}
+
+func tryFullDetails(api gophercloud.CloudServersProvider) {
servers, err := api.ListServers()
if err != nil {
panic(err)
}
if !*quiet {
+ fmt.Println("Id,Name,AccessIPv4,Status,Progress")
for _, s := range servers {
- fmt.Printf("%s\n", s.Id)
+ fmt.Printf("%s,\"%s\",%s,%s,%d\n", s.Id, s.Name, s.AccessIPv4, s.Status, s.Progress)
}
}
}
+