Bug 805983

Summary: [REST API] Wrong response message/text when requesting application restart
Product: OKD Reporter: Xavier Coulon <xcoulon>
Component: PodAssignee: Ravi Sankar <rpenta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: adietish, dmcphers, jhou, rmillner, rpenta
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-13 23:43:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xavier Coulon 2012-03-22 15:54:29 UTC
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <application>
    <name>sample</name>
    <uuid>5229a2c0f1424aed90d4ca8f20c0f9a2</uuid>
    <domain-id>foobar</domain-id>
    <creation-time>2012-03-19T10:48:26-04:00</creation-time>
    <links>
      <link>
        <rel>Get application gears</rel>
        <href>/domains/foobar/applications/sample/gears</href>
        <optional-params/>
        <method>GET</method>
        <required-params/>
      </link>
      <link>
        <rel>Stop application</rel>
        <href>/domains/foobar/applications/sample/events</href>
        <optional-params/>
        <method>POST</method>
        <required-params>
          <param>
            <name>event</name>
            <description>event</description>
            <valid-options>stop</valid-options>
            <type>string</type>
          </param>
        </required-params>
      </link>
      <link>
        <rel>Restart application</rel>
        <href>/domains/foobar/applications/sample/events</href>
        <optional-params/>
        <method>POST</method>
        <required-params>
          <param>
            <name>event</name>
            <description>event</description>
            <valid-options>restart</valid-options>
            <type>string</type>
          </param>
        </required-params>
      </link>
      <link>
        <rel>Add embedded cartridge</rel>
        <href>/domains/foobar/applications/sample/cartridges</href>
        <optional-params/>
        <method>POST</method>
        <required-params>
          <param>
            <name>cartridge</name>
            <description>framework-type, e.g.: mysql-5.1</description>
            <valid-options>
              <valid-option>postgresql-8.4</valid-option>
              <valid-option>metrics-0.1</valid-option>
              <valid-option>mysql-5.1</valid-option>
              <valid-option>jenkins-client-1.4</valid-option>
              <valid-option>10gen-mms-agent-0.1</valid-option>
              <valid-option>phpmyadmin-3.4</valid-option>
              <valid-option>rockmongo-1.1</valid-option>
              <valid-option>cron-1.4</valid-option>
              <valid-option>mongodb-2.0</valid-option>
            </valid-options>
            <type>string</type>
          </param>
        </required-params>
      </link>
      <link>
        <rel>Delete application</rel>
        <href>/domains/foobar/applications/sample</href>
        <optional-params/>
        <method>DELETE</method>
        <required-params/>
      </link>
      <link>
        <rel>Start application</rel>
        <href>/domains/foobar/applications/sample/events</href>
        <optional-params/>
        <method>POST</method>
        <required-params>
          <param>
            <name>event</name>
            <description>event</description>
            <valid-options>start</valid-options>
            <type>string</type>
          </param>
        </required-params>
      </link>
      <link>
        <rel>List embedded cartridges</rel>
        <href>/domains/foobar/applications/sample/cartridges</href>
        <optional-params/>
        <method>GET</method>
        <required-params/>
      </link>
      <link>
        <rel>Force stop application</rel>
        <href>/domains/foobar/applications/sample/events</href>
        <optional-params/>
        <method>POST</method>
        <required-params>
          <param>
            <name>event</name>
            <description>event</description>
            <valid-options>force-stop</valid-options>
            <type>string</type>
          </param>
        </required-params>
      </link>
    </links>
    <aliases/>
    <framework>jbossas-7</framework>
    <embedded>
    </embedded>
  </application>
  <version>1.0</version>
  <type>application</type>
  <status>ok</status>
  <messages>
    <message>
      <field nil="true"></field>
      <exit-code nil="true"></exit-code>
      <text>Added restart to application sample</text>
      <severity>INFO</severity>
    </message>
  </messages>
</response>

Comment 1 Lili Nader 2012-03-24 01:40:30 UTC
What is the right message?

Comment 2 Xavier Coulon 2012-03-26 08:02:24 UTC
Could it be something like 'Application is restarting' ?

Comment 3 Xavier Coulon 2012-04-03 08:57:35 UTC
Lili,

Sorry, I realize now that I did not initially put a proper comment on that issue. 
Basically, we'll probably re-use the <message> element(s) from the response and display them to the end user, which is why I reported the issue, because "Added restart to application sample" could be reformulated into something like "Application is restarting".

Again, sorry for the raw message at first.

Comment 4 Ravi Sankar 2012-06-27 22:56:41 UTC
Fixed in git rev 3a2c635c0e7

Comment 5 Jianwei Hou 2012-06-28 02:28:32 UTC
verified on devevn_1868

ways to operate:
1.create an application p1
2.use REST API to restart application:
curl -k -H "Accept: application/xml" --user jhou:xxx  https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events -X POST -d event=restart > restart.txt
3.open restart.txt to check for message,now the message is "Application p1 has restarted". messages are below:


<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>ok</status>
  <data>
    <application>
      <scale-min>1</scale-min>
      <uuid>b2a5192833534e18b0ccde0e45d9c570</uuid>
      <git-url>ssh://b2a5192833534e18b0ccde0e45d9c570.rhcloud.com/~/git/p1.git/</git-url>
      <framework>php-5.3</framework>
      <gear-profile>small</gear-profile>
      <embedded>
      </embedded>
      <gear-count>1</gear-count>
      <app-url>http://p1-dn1.dev.rhcloud.com/</app-url>
      <scale-max>-1</scale-max>
      <creation-time>2012-06-27T22:04:52-04:00</creation-time>
      <scalable>false</scalable>
      <name>p1</name>
      <health-check-path>health_check.php</health-check-path>
      <aliases/>
      <domain-id>dn1</domain-id>
      <ssh-url>ssh://b2a5192833534e18b0ccde0e45d9c570.rhcloud.com</ssh-url>
      <links>
        <link>
          <rel>Delete application</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1</href>
          <method>DELETE</method>
          <optional-params/>
        </link>
        <link>
          <rel>Remove application alias</rel>
          <required-params>
            <param>
              <valid-options>remove-alias</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
            <param>
              <valid-options/>
              <type>string</type>
              <name>alias</name>
              <description>The application alias to be removed</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Show port</rel>
          <required-params>
            <param>
              <valid-options>show-port</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Get application gear groups</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/gear_groups</href>
          <method>GET</method>
          <optional-params/>
        </link>
        <link>
          <rel>Expose port</rel>
          <required-params>
            <param>
              <valid-options>expose-port</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Get application descriptor</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/descriptor</href>
          <method>GET</method>
          <optional-params/>
        </link>
        <link>
          <rel>List embedded cartridges</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/cartridges</href>
          <method>GET</method>
          <optional-params/>
        </link>
        <link>
          <rel>Add embedded cartridge</rel>
          <required-params>
            <param>
              <valid-options>
                <valid-option>mongodb-2.0</valid-option>
                <valid-option>cron-1.4</valid-option>
                <valid-option>mysql-5.1</valid-option>
                <valid-option>postgresql-8.4</valid-option>
                <valid-option>haproxy-1.4</valid-option>
                <valid-option>10gen-mms-agent-0.1</valid-option>
                <valid-option>phpmyadmin-3.4</valid-option>
                <valid-option>metrics-0.1</valid-option>
                <valid-option>phpmoadmin-1.0</valid-option>
                <valid-option>rockmongo-1.1</valid-option>
                <valid-option>jenkins-client-1.4</valid-option>
              </valid-options>
              <type>string</type>
              <name>cartridge</name>
              <description>framework-type, e.g.: mysql-5.1</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/cartridges</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Get application gears</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/gears</href>
          <method>GET</method>
          <optional-params/>
        </link>
        <link>
          <rel>Add application alias</rel>
          <required-params>
            <param>
              <valid-options>add-alias</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
            <param>
              <valid-options/>
              <type>string</type>
              <name>alias</name>
              <description>The server alias for the application</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Scale up application</rel>
          <required-params>
            <param>
              <valid-options>scale-up</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Start application</rel>
          <required-params>
            <param>
              <valid-options>start</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Scale down application</rel>
          <required-params>
            <param>
              <valid-options>scale-down</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Conceal port</rel>
          <required-params>
            <param>
              <valid-options>conceal-port</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Force stop application</rel>
          <required-params>
            <param>
              <valid-options>force-stop</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Restart application</rel>
          <required-params>
            <param>
              <valid-options>restart</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Stop application</rel>
          <required-params>
            <param>
              <valid-options>stop</valid-options>
              <type>string</type>
              <name>event</name>
              <description>event</description>
            </param>
          </required-params>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1/events</href>
          <method>POST</method>
          <optional-params/>
        </link>
        <link>
          <rel>Get application</rel>
          <required-params/>
          <href>https://ec2-204-236-206-44.compute-1.amazonaws.com/broker/rest/domains/dn1/applications/p1</href>
          <method>GET</method>
          <optional-params/>
        </link>
      </links>
    </application>
  </data>
  <messages>
    <message>
      <exit-code nil="true"></exit-code>
      <text>Application p1 has restarted</text>
      <field nil="true"></field>
      <severity>INFO</severity>
    </message>
  </messages>
  <type>application</type>
  <version>1.0</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
  </supported-api-versions>
</response>