You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2017/04/24 14:14:25 UTC

[GitHub] brooklyn-client pull request #48: Catalog add tweaks

GitHub user ahgittin opened a pull request:

    https://github.com/apache/brooklyn-client/pull/48

    Catalog add tweaks

    Fixes items noted in #44

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ahgittin/brooklyn-client catalog-add-tweaks

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-client/pull/48.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #48
    
----
commit 9f4224d9a082152362cbb8b8e2e6edb66286fe9d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2017-04-24T13:02:20Z

    update description

commit 8f178805661b93dd2fb28f3ac91e7c575f1427b9
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2017-04-24T13:02:28Z

    correctly handle file:// urls

commit 2094e8295edbb4c8791dece188db44c3417a533a
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2017-04-24T13:38:36Z

    better error message when server returns an error
    
    we need better error handling; this solves the thing I was wondering, which is where
    was the exception coming from.

commit e974f7383a5f662f6089c8fa9d877667e56e6505
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2017-04-24T14:06:35Z

    set content type to unknown to use auto-detect when posting to catalog
    
    (prevent reader error if the item is a zip)

commit d2203982604ede161d87b8ae7d4ba0ad657bcf91
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2017-04-24T14:11:22Z

    display nice error if argument is omitted

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-client pull request #48: Catalog add tweaks

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/brooklyn-client/pull/48


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-client issue #48: Catalog add tweaks

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-client/pull/48
  
    looks good @ahgittin, will do some tests on it tomorrow


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-client pull request #48: Catalog add tweaks

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-client/pull/48#discussion_r113151481
  
    --- Diff: cli/api/catalog/catalog.go ---
    @@ -219,20 +219,22 @@ func AddCatalog(network *net.Network, resource string) (map[string]models.Catalo
     	urlString := "/v1/catalog"
     	var entities map[string]models.CatalogEntitySummary
     
    -	//Assume application/json. This is correct for http/file resources.
    -	//Zips will need application/x-zip
    -	contentType := "application/json"
    +	//Force auto-detect by default
    +	contentType := "application/octet-stream"
     	u, err := url.Parse(resource)
     	if err != nil {
     		return nil, err
     	}
     
     	//Only deal with the below file types
    -	if "" != u.Scheme && "file" != u.Scheme  && "http" != u.Scheme && "https" != u.Scheme{
    +	if "" != u.Scheme && "file" != u.Scheme  && "http" != u.Scheme && "https" != u.Scheme {
     		return nil, errors.New("Unrecognised protocol scheme: " + u.Scheme)
     	}
     
     	if "" == u.Scheme || "file" == u.Scheme {
    +                if "file" == u.Scheme {
    --- End diff --
    
    We need to check that the path is not empty:
    ```
                    if "file" == u.Scheme {
    			if u.Path == "" {
    				return nil, errors.New("No resource in 'file:' URL: " + resource)
    			}
                            resource = u.Path
                    }
    ```
    otherwise `br catalog add file://test.zip` will fail with a panic  (needs to be `br catalog add file:///some/path/test.zip`).
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-client issue #48: Catalog add tweaks

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-client/pull/48
  
    This looks good to me, and will be useful already, we can add the additional check above at a later point; will merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---