Hi Martin, Earlier "applicationId" was under the "applicationPolicy" section. Now we have moved it to the root level. I think this is the reason for the error you are seeing.
Thanks On Wed, Dec 17, 2014 at 11:12 PM, Martin Eppel (meppel) <[email protected]> wrote: > > Hi Imesh, > > > > the applicationId is set to the correct value (just take a look at the > attached application json and deployment Jason). I traced the value of the > two values which are compared and the applicationId of the deployment > policy reports as null. So my guess is that the RESTAPI failed to properly > read the deployment policy , either the format has changed again or > something else is missing. > > > > > > *From:* Imesh Gunaratne [mailto:[email protected]] > *Sent:* Tuesday, December 16, 2014 8:21 PM > *To:* dev > *Subject:* Re: [Testing] Stratos 4.1.0 Alpha - error when deploying > application /deployment policy > > > > Hi Martin, > > > > We are sorry for the inconvenience caused by the API changes. The reason > for doing those refinements was to fix the application deployment process > and terminology issues we identified recently when testing the complete > work flow. > > > > Regarding the error you have found: > > Application id test_app_1 does not match with the deployment policy > > > > This is a new validation we have added to verify whether the application > id sent in the URL and the deployment policy are matching. In your > deployment policy can you please update the application id attribute as > follows: > > > > { > > "applicationId": "test_app_1", > > "applicationPolicy": { > > "networkPartition": [ > > { > > ... > > } > > ] > > }, > > "childPolicies": [ > > { > > ... > > } > > ] > > } > > > > Thanks > > > > On Wed, Dec 17, 2014 at 1:18 AM, Martin Eppel (meppel) <[email protected]> > wrote: > > > > I deployed an application with applicationId = “test_app_1” (see attached > application json). When I deploy a deployment policy (see REST request > below) which uses "applicationId": "test_app_1" - (see attached deployment > policy json) I get the error below. > > > > Is this the correct REST API to deploy a deployment application (see REST > API , REST request below). Not sure what’s wrong or missing ? > > > > > > Btw, this is probably the third or fourth time we changed the REST APIs, > do you think they will change again over the next few days ? > > > > > > Thanks > > > > Martin > > > > > > *REST API (as in StratosApiV41) as of 12/16/2014* > > > > @POST > > @Path("/application/{applicationId}/deploy") > > > > > > *REST request: * > > > > root@octl-01:/opt/qtcm/octl/stratos# curl -X POST -H "Content-Type: > application/json" > -d@'new_grouping_artifacts/working_scenarios/single-app/deployment-policy.json' > -k -v -u admin:admin > https://localhost:9443/api/application/test_app_1/deploy > > * About to connect() to localhost port 9443 (#0) > > * Trying 127.0.0.1... connected > > * successfully set certificate verify locations: > > * CAfile: none > > CApath: /etc/ssl/certs > > * SSLv3, TLS handshake, Client hello (1): > > * SSLv3, TLS handshake, Server hello (2): > > * SSLv3, TLS handshake, CERT (11): > > * SSLv3, TLS handshake, Server key exchange (12): > > * SSLv3, TLS handshake, Server finished (14): > > * SSLv3, TLS handshake, Client key exchange (16): > > * SSLv3, TLS change cipher, Client hello (1): > > * SSLv3, TLS handshake, Finished (20): > > * SSLv3, TLS change cipher, Client hello (1): > > * SSLv3, TLS handshake, Finished (20): > > * SSL connection using ECDHE-RSA-DES-CBC3-SHA > > * Server certificate: > > * subject: C=US; ST=CA; L=Mountain View; O=WSO2; CN=localhost > > * start date: 2010-02-19 07:02:26 GMT > > * expire date: 2035-02-13 07:02:26 GMT > > * issuer: C=US; ST=CA; L=Mountain View; O=WSO2; CN=localhost > > * SSL certificate verify result: unable to get local issuer > certificate (20), continuing anyway. > > * Server auth using Basic with user 'admin' > > > POST /api/application/test_app_1/deploy HTTP/1.1 > > > Authorization: Basic YWRtaW46YWRtaW4= > > > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 > OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 > > > Host: localhost:9443 > > > Accept: */* > > > Content-Type: application/json > > > Content-Length: 1059 > > > Expect: 100-continue > > > > > < HTTP/1.1 100 Continue > > < HTTP/1.1 400 Bad Request > > < Date: Tue, 16 Dec 2014 19:40:58 GMT > > < Content-Type: application/json > > < Content-Length: 120 > > < Connection: close > > < Server: WSO2 Carbon Server > > < > > * Closing connection #0 > > * SSLv3, TLS alert, Client hello (1): > > {"Error":{ "errorCode": " 400", "errorMessage": " Application id > test_app_1 does not match with the deployment > policy"}}root@octl-01:/opt/qtcm/octl/stratos# > curl -X POST -H "Content-Type: > applicatocalhost:9443/api/application/test_app_1/deployenarios/single-app/deployment-policy.json' > -k -v -u admin:admin https://lo > > * About to connect() to localhost port 9443 (#0) > > * Trying 127.0.0.1... connected > > * successfully set certificate verify locations: > > * CAfile: none > > CApath: /etc/ssl/certs > > * SSLv3, TLS handshake, Client hello (1): > > * SSLv3, TLS handshake, Server hello (2): > > * SSLv3, TLS handshake, CERT (11): > > * SSLv3, TLS handshake, Server key exchange (12): > > * SSLv3, TLS handshake, Server finished (14): > > * SSLv3, TLS handshake, Client key exchange (16): > > * SSLv3, TLS change cipher, Client hello (1): > > * SSLv3, TLS handshake, Finished (20): > > * SSLv3, TLS change cipher, Client hello (1): > > * SSLv3, TLS handshake, Finished (20): > > * SSL connection using ECDHE-RSA-DES-CBC3-SHA > > * Server certificate: > > * subject: C=US; ST=CA; L=Mountain View; O=WSO2; CN=localhost > > * start date: 2010-02-19 07:02:26 GMT > > * expire date: 2035-02-13 07:02:26 GMT > > * issuer: C=US; ST=CA; L=Mountain View; O=WSO2; CN=localhost > > * SSL certificate verify result: unable to get local issuer > certificate (20), continuing anyway. > > * Server auth using Basic with user 'admin' > > > POST /api/application/test_app_1/deploy HTTP/1.1 > > > Authorization: Basic YWRtaW46YWRtaW4= > > > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 > OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 > > > Host: localhost:9443 > > > Accept: */* > > > Content-Type: application/json > > > Content-Length: 1059 > > > Expect: 100-continue > > > > > < HTTP/1.1 100 Continue > > < HTTP/1.1 400 Bad Request > > < Date: Tue, 16 Dec 2014 19:41:26 GMT > > < Content-Type: application/json > > < Content-Length: 120 > > < Connection: close > > < Server: WSO2 Carbon Server > > < > > * Closing connection #0 > > * SSLv3, TLS alert, Client hello (1): > > {"Error":{ "errorCode": " 400", "errorMessage": " Application id > test_app_1 does not match with the deployment policy"}} > > > > > > > > *Stratos exception:* > > > > TID: [0] [STRATOS] [2014-12-16 19:23:14,958] ERROR > {org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper} - > Application id test_app_1 does not match with the deployment policy > {org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper} > > org.apache.stratos.rest.endpoint.exception.RestAPIException: Application > id test_app_1 does not match with the deployment policy > > at > org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.deployApplication(StratosApiV41Utils.java:1004) > > at > org.apache.stratos.rest.endpoint.api.StratosApiV41.deployApplication(StratosApiV41.java:404) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > > > -- > > Imesh Gunaratne > > > > Technical Lead, WSO2 > > Committer & PMC Member, Apache Stratos > -- Imesh Gunaratne Technical Lead, WSO2 Committer & PMC Member, Apache Stratos
