Bug 981780

Summary: "cartridge reload" should display client messages
Product: OpenShift Online Reporter: Hiro Asari <hasari>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: abhgupta, bmeng, jhonce, jkeck, xtian, yadu
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-17 13:27:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 981774, 1012138    
Bug Blocks: 981528, 1010846    

Description Hiro Asari 2013-07-05 19:28:00 UTC
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 19:01:16 UTC
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 04:12:02 UTC
Fixed in https://github.com/openshift/rhc/pull/421

Comment 3 openshift-github-bot 2013-07-09 18:04:36 UTC
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 21:05:45 UTC
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 22:03:16 UTC
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 22:16:36 UTC
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 06:11:14 UTC
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 07:44:51 UTC
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 19:56:13 UTC
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 21:05:04 UTC
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 23:43:28 UTC
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 11:51:06 UTC
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