Merge pull request #179 from msabramo/OpenstackApi_query_for_type_compute

Query for type "compute" instead of name "nova"
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..2655ebc
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# All files
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+trim_trailing_whitespace = true
+
+# Golang
+[*.go]
+indent_style = tab
+indent_size = 2
diff --git a/context.go b/context.go
index aca869c..e753c8b 100644
--- a/context.go
+++ b/context.go
@@ -4,6 +4,7 @@
 	"net/http"
 	"strings"
 	"fmt"
+	"github.com/tonnerre/golang-pretty"
 )
 
 // Provider structures exist for each tangible provider of OpenStack service.
@@ -107,20 +108,30 @@
 	return Provider{}, ErrProvider
 }
 
+func getServiceCatalogFromAccessProvider(provider AccessProvider) ([]CatalogEntry) {
+	access, found := provider.(*Access)
+	if found {
+		return access.ServiceCatalog
+	} else {
+		return nil
+	}
+}
+
 // Instantiates a Cloud Servers API for the provider given.
-func (c *Context) ServersApi(acc AccessProvider, criteria ApiCriteria) (CloudServersProvider, error) {
-	url := acc.FirstEndpointUrlByCriteria(criteria)
+func (c *Context) ServersApi(provider AccessProvider, criteria ApiCriteria) (CloudServersProvider, error) {
+	url := provider.FirstEndpointUrlByCriteria(criteria)
 	if url == "" {
 		var err = fmt.Errorf(
-			"Missing endpoint, or insufficient privileges to access endpoint; criteria = %# v",
-			criteria)
+			"Missing endpoint, or insufficient privileges to access endpoint; criteria = %# v; serviceCatalog = %# v",
+			pretty.Formatter(criteria),
+			pretty.Formatter(getServiceCatalogFromAccessProvider(provider)))
 		return nil, err
 	}
 
 	gcp := &genericServersProvider{
 		endpoint: url,
 		context:  c,
-		access:   acc,
+		access:   provider,
 	}
 
 	return gcp, nil