Bug 981780 - "cartridge reload" should display client messages
"cartridge reload" should display client messages
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Jhon Honce
libra bugs
:
Depends On: 981774 1012138
Blocks: 981528 1010846
  Show dependency treegraph
 
Reported: 2013-07-05 15:28 EDT by Hiro Asari
Modified: 2015-05-14 19:23 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-17 09:27:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hiro Asari 2013-07-05 15:28:00 EDT
Description of problem:

'rhc cartridge reload X -a Y' either bombs spectacularly, or displays 'X reloaded' even when it shouldn't.


Version-Release number of selected component (if applicable):

How reproducible:
Always

Steps to Reproduce:
1. Create a jbossas-7 app
2. Sync origin-server repo with https://github.com/BanzaiMan/origin-server/tree/dev/hasari/rhc_cartridge_reload_bug (near devenv_3450)
3. stop postgresql cart, then reload.

Actual results:
$ bx bin/rhc cartridge reload postgresql-9.2 -a j7
RESULT:
postgresql-9.2 reloaded


Expected results:
$ bx bin/rhc cartridge reload postgresql-9.2 -a j7
RESULT:
'reload' is valid only when the database is running

(or something similar)

Additional info:

As of this writing, 'cartridge reload' does not consider the action's result:

https://github.com/openshift/rhc/blob/93edcae96c3b135a0aedaf1b8f8d17064a419f40/lib/rhc/commands/cartridge.rb#L183-L186
Comment 1 Hiro Asari 2013-07-08 15:01:16 EDT
Once https://bugzilla.redhat.com/show_bug.cgi?id=981774 is fixed, there is no reason to sync up with https://github.com/BanzaiMan/origin-server/tree/dev/hasari/rhc_cartridge_reload_bug, but use the master from openshift/origin-server.
Comment 2 Clayton Coleman 2013-07-09 00:12:02 EDT
Fixed in https://github.com/openshift/rhc/pull/421
Comment 3 openshift-github-bot 2013-07-09 14:04:36 EDT
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/50e0ab953bdc12a4d359df6579538f35dad8fa4a
Bug 981780 - Filter broker results more effectively, and display results on cartridge actions
Comment 4 Hiro Asari 2013-07-09 17:05:45 EDT
This only shows CLIENT_RESULT, right? Everything else—CLIENT_MESSAGE, CLIENT_ERROR and others—are not getting displayed by CLI, only in the platform-trace.log.

We can use CLIENT_RESULT, I guess, but this seems semantically incorrect in some cases.
Comment 5 Hiro Asari 2013-07-09 18:03:16 EDT
https://github.com/openshift/origin-server/pull/3020 shows this problem with the postgresql cartridge.

see https://gist.github.com/BanzaiMan/b916cd695e2b7dc31db4 for logs.
Comment 6 Hiro Asari 2013-07-09 18:16:36 EDT
https://github.com/openshift/origin-server/pull/3020 was updated to use client_result for now. That should be good enough for this ticket.
Comment 7 Yan Du 2013-07-11 02:11:14 EDT
verified on devenv_3481
rhc-1.11.4

Reload psql( postgresql-8.4/postgresql-9.2) can show the message "'reload' is valid only when the database is running" after stop psql cartridge

steps to verified:

1. rhc app create -a jboss7 jbossas-7 postgresql-8.4
2. rhc cartridge stop -a jboss7 -c postgresql-8.4
3. rhc cartridge reload -a jboss7 -c postgresql-8.4

[root@localhost ~]# rhc cartridge stop -a jboss7 -c postgresql-8.4
Stopping postgresql-8.4 ... done
[root@localhost ~]# rhc cartridge reload -a jboss7 -c postgresql-8.4
Reloading postgresql-8.4 ... done

'reload' is valid only when the database is running


[root@localhost ~]# cstop -a jboss7n -c postgresql-9.2
Stopping postgresql-9.2 ... done
[root@localhost ~]# creload -a jboss7n -c postgresql-9.2
Reloading postgresql-9.2 ... done

'reload' is valid only when the database is running


move to verified.
Comment 8 Yan Du 2013-07-15 03:44:51 EDT
sorry for my careless,retest on devenv-stage_404,got below result

[root@localhost ~]# rhc cartridge reload -a jboss7 -c postgresql-8.4
Reloading postgresql-8.4 ... done

'reload' is valid only when the database is running

if 'reload' is valid only when the database is running, then the message "Reloading postgresql-8.4 ... done" should not show. it is conflicting.
Comment 9 Hiro Asari 2013-09-25 15:56:13 EDT
https://github.com/openshift/rhc/blob/e640a8724147604b2b8e57306c438f4926a3a919/lib/rhc/commands/cartridge.rb#L322-L325

Currently, CLI's `cartridge` command assumes that all subcommands succeed, and there is no way for the runtime to communicate the error condition.

Additionally, postgresql's reload requiring the cartridge being down is something of an anomaly, so it is not a good idea to deal with this special case on the client side.

One thing we can do is to exit with a nonzero status after using "client_error" to set the message. However, the message doesn't show up nicely on the client side; something is trimming the trailing white spaces, so that the message looks weird. (I haven't figured out what is doing this.)

$ bx bin/rhc cartridge reload postgresql-9.2 -a rack
Reloading postgresql-9.2 ... 
'reload' is valid only when the database is running.Unable to complete the requested operation due to: Failed to correctly execute all parallel operations.
Reference ID: fb879a215759f75654f6c879d61cd16c
Comment 10 Abhishek Gupta 2013-09-25 17:05:04 EDT
The broker issues highlighted in comment 9 should be fixed with --> https://github.com/openshift/origin-server/pull/3708
Comment 11 openshift-github-bot 2013-09-25 19:43:28 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/c2e9b8176b527c27caaf63a9a76177fa9bddbd58
Bug 981780 - Fail reload if database is not running
Comment 12 Meng Bo 2013-09-26 07:51:06 EDT
Checked on devenv_3833, issue has been fixed.

[bmeng@localhost devtest]$ rhc cartridge-reload postgres -a php1
Using postgresql-9.2 (PostgreSQL Database 9.2) for 'postgres'
Reloading postgresql-9.2 ... 
'reload' is valid only when the database is running

Note You need to log in before you can comment on or make changes to this bug.