You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/10/25 19:11:00 UTC
[06/19] brooklyn-client git commit: Simplify output of catalog add
Simplify output of catalog add
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/9ea65f92
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/9ea65f92
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/9ea65f92
Branch: refs/heads/master
Commit: 9ea65f9295ad923eaa9e137996327e96f78c5e7b
Parents: 2634701
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu Oct 13 20:56:10 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu Oct 13 20:56:10 2016 +0100
----------------------------------------------------------------------
cli/api/catalog/catalog.go | 8 +++++---
cli/commands/add-catalog.go | 4 +++-
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/9ea65f92/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index 6a017f5..6f0797a 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -161,13 +161,15 @@ func Locations(network *net.Network) ([]models.CatalogLocationSummary, error) {
return catalogLocations, err
}
-func AddCatalog(network *net.Network, resource string) (string, error) {
+func AddCatalog(network *net.Network, resource string) (map[string]models.CatalogEntitySummary, error) {
url := "/v1/catalog"
+ var entities map[string]models.CatalogEntitySummary
body, err := network.SendPostResourceRequest(url, resource, "application/json")
if err != nil {
- return "", err
+ return nil, err
}
- return string(body), nil
+ err = json.Unmarshal(body, &entities)
+ return entities, nil
}
func Reset(network *net.Network) (string, error) {
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/9ea65f92/cli/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-catalog.go b/cli/commands/add-catalog.go
index d6ceba7..2d736c3 100644
--- a/cli/commands/add-catalog.go
+++ b/cli/commands/add-catalog.go
@@ -55,5 +55,7 @@ func (cmd *AddCatalog) Run(scope scope.Scope, c *cli.Context) {
if nil != err {
error_handler.ErrorExit(err)
}
- fmt.Println(create)
+ for id, _ := range create {
+ fmt.Println(id)
+ }
}