brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #782: Adds `PUT /applications/{appid}`
Date Tue, 01 Aug 2017 14:42:35 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/782#discussion_r130627191
  
    --- Diff: rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java
---
    @@ -110,15 +112,32 @@ public Response createFromYaml(
                         required = true)
                 String yaml);
     
    +    @Beta
    +    @PUT
    +    @Path("/{application}")
    +    @Consumes({"application/x-yaml",
    +            // see http://stackoverflow.com/questions/332129/yaml-mime-type
    +            "text/yaml", "text/x-yaml", "application/yaml"})
    +    @ApiOperation(
    +            value = "[BETA] Create and start a new application from YAML, with the given
id",
    +            response = org.apache.brooklyn.rest.domain.TaskSummary.class
    +    )
    +    @ApiResponses(value = {
    +            @ApiResponse(code = 404, message = "Undefined entity or location"),
    +            @ApiResponse(code = 409, message = "Application already registered")
    --- End diff --
    
    @m4rkmckenna This works for me. I ran `mvn clean install -o -DskipTests` for all brooklyn
projects, then I unpacked and ran `brooklyn-dist/karaf/apache-brooklyn/target/apache-brooklyn-0.12.0-SNAPSHOT.tar.gz`,
and then tried to deploy with the same id twice:
    
    ```
    curl -v -X PUT -u admin:password -H "Content-Type: application/x-yaml" http://localhost:8081/v1/applications/thisismyid
--data-binary @/Users/aledsage/amp-cluster/app.yaml
    
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 8081 (#0)
    * Server auth using Basic with user 'admin'
    > PUT /v1/applications/thisismyid HTTP/1.1
    > Host: localhost:8081
    > Authorization: Basic YWRtaW46cGFzc3dvcmQ=
    > User-Agent: curl/7.51.0
    > Accept: */*
    > Content-Type: application/x-yaml
    > Content-Length: 69
    > 
    * upload completely sent off: 69 out of 69 bytes
    < HTTP/1.1 409 Conflict
    < Date: Tue, 01 Aug 2017 14:38:34 GMT
    < Content-Type: application/json
    < Cache-Control: no-cache, no-store
    < Pragma: no-cache
    < Expires: 0
    < Transfer-Encoding: chunked
    < Server: Jetty(9.2.19.v20160908)
    < 
    {"message":"Error launching blueprint, id already exists: IdAlreadyExistsException: call
to manage entity BasicApplicationImpl{id=thisismyid} (ManagementTransitionMode[NONEXISTENT->MANAGED_PRIMARY])
but different entity BasicApplicationImpl{id=thisismyid} already known under that id 'thisismyid'
at org.apache.brooklyn.core.mgmt.internal.LocalEntityManager@4a88c541","details":"org.apache.brooklyn.core.mgmt.internal.IdAlreadyExistsException:
call to manage entity BasicApplicationImpl{id=thisismyid} (ManagementTransitionMode[NONEXISTENT->MANAGED_PRIMARY])
but different entity BasicApplicationImpl{id=thisismyid} already known under that id 'thisismyid'
at org.apache.brooklyn.core.mgmt.internal.LocalEntityManager@4a88c541\n\tat org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.manageNonRecursive(LocalEntityManager.java:701)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.access$300(LocalEntityManager.java:84)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEn
 tityManager$2.apply(LocalEntityManager.java:419)\n\tat org.apache.brooklyn.core.mgmt.internal.LocalEntityManager$2.apply(LocalEntityManager.java:374)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.recursively(LocalEntityManager.java:645)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.manageRecursive(LocalEntityManager.java:439)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.manage(LocalEntityManager.java:333)\n\tat
org.apache.brooklyn.core.mgmt.internal.LocalEntityManager.createEntity(LocalEntityManager.java:177)\n\tat
org.apache.brooklyn.core.mgmt.EntityManagementUtils.createUnstarted(EntityManagementUtils.java:94)\n\tat
org.apache.brooklyn.rest.resources.ApplicationResource.launch(ApplicationResource.java:312)\n\tat
org.apache.brooklyn.rest.resources.ApplicationResource.createFromYaml(ApplicationResource.java:299)\n\tat
org.apache.brooklyn.rest.resources.ApplicationResource.createFromYamlWithAppId(ApplicationResource.java:251)\n\t
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat
java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)\n\tat
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)\n\tat org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)\n\tat
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)\n\tat org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)\n\tat
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)\n\tat
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)\n\tat
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO
 bserver.java:121)\n\tat org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:262)\n\tat
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)\n\tat
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)\n\tat
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)\n\tat
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)\n\tat
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299)\n\tat
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:235)\n\tat
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)\n\tat org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274)\n\tat
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(
 ServletHandler.java:587)\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(Http*
Curl_http_done: called premature == 0
    * Connection #0 to host localhost left intact
    ServiceServletHandler.java:71)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)\n\tat
org.eclipse.jetty.server.handler.HandlerWrapper.ha
 ndle(HandlerWrapper.java:97)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:499)\n\tat
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\n\tat
org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\n\tat java.lang.Thread.run(Thread.java:745)\n","error":409}
    ```
    
    It's not pretty, with the full stacktrace being included, but it does give the 409 response
and does include the exception's message.


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

Mime
View raw message