You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by tbouron <gi...@git.apache.org> on 2017/06/23 10:49:27 UTC

[GitHub] brooklyn-server pull request #744: Allow catalog item to be force-updated vi...

GitHub user tbouron opened a pull request:

    https://github.com/apache/brooklyn-server/pull/744

    Allow catalog item to be force-updated via query string flag on the REST API

    # Issue
    
    When `POST`ing a catalog item (YAML file) with an ID and version to already exist, the REST API returns a `400` with a message inviting the user to use a `forceUpdate` flag if one wishes to. However, this flag is only available internally and not exposed to the REST API.
    
    Another issue is that under the same condition for ZIP/JAR archives, the `OsgiArchiveInstaller` silently ignores the update and therefore, the REST API returns a `201` even though it has done anything.
    
    # Fix
    
    This fixes both above issues by:
    - exposing a `forceUpdate` flag on the REST API for `/v1/catalog`
    - checking the result code from `OsgiArchiveInstaller.install()` method and throw the same error message inviting the user to use the flag

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

    $ git pull https://github.com/tbouron/brooklyn-server feature/catalog-force-update

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

    https://github.com/apache/brooklyn-server/pull/744.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 #744
    
----
commit 884b901e052c793a14e82f0e3d11fb100fad5dc0
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Date:   2017-06-23T10:07:27Z

    Allow catalog item (YAML or bundle) to be force-updated via query string flag on the REST API

----


---
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-server pull request #744: Allow catalog item to be force-updated vi...

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

    https://github.com/apache/brooklyn-server/pull/744#discussion_r123742309
  
    --- Diff: rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---
    @@ -67,7 +67,7 @@
                 @ApiResponse(code = 400, message = "Error processing the given YAML"),
                 @ApiResponse(code = 201, message = "Catalog items added successfully")
         })
    -    public Response create(String yaml);
    +    public Response create(String yaml, @QueryParam("forceUpdate") @DefaultValue("false") boolean forceUpdate);
    --- End diff --
    
    Good call @m4rkmckenna, I just pushed the changes


---
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-server pull request #744: Allow catalog item to be force-updated vi...

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

    https://github.com/apache/brooklyn-server/pull/744


---
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-server pull request #744: Allow catalog item to be force-updated vi...

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

    https://github.com/apache/brooklyn-server/pull/744#discussion_r123740886
  
    --- Diff: rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---
    @@ -67,7 +67,7 @@
                 @ApiResponse(code = 400, message = "Error processing the given YAML"),
                 @ApiResponse(code = 201, message = "Catalog items added successfully")
         })
    -    public Response create(String yaml);
    +    public Response create(String yaml, @QueryParam("forceUpdate") @DefaultValue("false") boolean forceUpdate);
    --- End diff --
    
    Can you add `@ApiParam(***)` so that the swagger doc has some detail


---
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.
---