Bug 1018077 - Fail to show correct match messages when add special character cartridge like "*##" to an exist app
Fail to show correct match messages when add special character cartridge like...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Jordan Liggitt
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-11 03:12 EDT by Nan Wei
Modified: 2015-05-14 22:25 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-23 22:33:42 EST
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 Nan Wei 2013-10-11 03:12:46 EDT
Description of problem:
When add invalid cartridge like "*##" to a exist app with the rhc 1.16.0, it reveals some error messages as follow: 
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:54:in `match_cart': invalid regular expression; there's no previous pattern, to which '*' would define cardinality at 3: /\b*##\b/ (RegexpError)
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/application.rb:64:in `any?'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `each'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `any?'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `match_cart'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `select'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:9:in `map'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:9:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/cartridge.rb:310:in `cartridge_action'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/cartridge.rb:153:in `stop'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `send'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `execute'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:276:in `to_commander'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:383:in `run_active_command'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/command_runner.rb:73:in `run!'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cli.rb:37:in `start'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/bin/rhc:20
    from /usr/bin/rhc:23:in `load'
    from /usr/bin/rhc:23 
But if the Client is  "rhc 1.15.6", it reveals "There are no cartridges that match '*##'".

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

How reproducible:
always

Steps to Reproduce:
1. Create a app 
#rhc app create app2 jbossews-1.0.
2. Try to add/stop/reload/start/restart an invalid cartridge to the app
#rhc cartridge add *## -a app2

Actual results:
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:54:in `match_cart': invalid regular expression; there's no previous pattern, to which '*' would define cardinality at 3: /\b*##\b/ (RegexpError)
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/application.rb:64:in `any?'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `each'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `any?'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:53:in `match_cart'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `select'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:9:in `map'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cartridge_helpers.rb:9:in `check_cartridges'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/cartridge.rb:310:in `cartridge_action'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/cartridge.rb:153:in `stop'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `send'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `execute'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:276:in `to_commander'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:383:in `run_active_command'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/command_runner.rb:73:in `run!'
    from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/cli.rb:37:in `start'
    from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/bin/rhc:20
    from /usr/bin/rhc:23:in `load'
    from /usr/bin/rhc:23 

Expected results:
There are no cartridges that match '*##'

Additional info:
Comment 1 Jessica Forrester 2013-11-12 17:05:29 EST
I can't reproduce this on rhc version 1.16.9, can you re-test and see if you are still able to recreate it.
Comment 2 Nan Wei 2013-11-12 21:36:28 EST
[weinan@dhcp-65-25 test]$ rhc --version
rhc 1.17.0
[weinan@dhcp-65-25 test]$ rhc app show pl
pl @ http://pl-nweidomain.ose-1107.com.cn/ (uuid: 5282045e37df70e4c2000464)
---------------------------------------------------------------------------
  Domain:     nweidomain
  Created:    Nov 12  6:35 PM
  Gears:      1 (defaults to small)
  Git URL:    ssh://5282045e37df70e4c2000464@pl-nweidomain.ose-1107.com.cn/~/git/pl.git/
  SSH:        5282045e37df70e4c2000464@pl-nweidomain.ose-1107.com.cn
  Deployment: auto (on git push)

  perl-5.10 (Perl 5.10)
  ---------------------
    Gears: Located with jenkins-client-1

  jenkins-client-1 (Jenkins Client)
  ---------------------------------
    Gears:   Located with perl-5.10
    Job URL: https://jk-nweidomain.ose-1107.com.cn/job/pl-build/
[weinan@dhcp-65-25 test]$ rhc cartridge add *## -a pl
/usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:54:in `match_cart': invalid regular expression; there's no previous pattern, to which '*' would define cardinality at 3: /\b*##\b/ (RegexpError)
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/rest/client.rb:506:in `any?'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:53:in `each'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:53:in `any?'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:53:in `match_cart'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:15:in `select'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:9:in `map'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cartridge_helpers.rb:9:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/commands/cartridge.rb:78:in `add'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/commands.rb:285:in `send'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/commands.rb:285:in `execute'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/commands.rb:276:in `to_commander'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:383:in `run_active_command'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/command_runner.rb:73:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/lib/rhc/cli.rb:37:in `start'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.0/bin/rhc:20
	from /usr/bin/rhc:19:in `load'
	from /usr/bin/rhc:19

It can reproduce this on rhc version 1.17.0.
Comment 3 Nan Wei 2013-11-12 22:06:56 EST
[weinan@dhcp-65-25 test]$ rhc --version
rhc 1.17.4
[weinan@dhcp-65-25 test]$ rhc cartridge add *## -a pl
/usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:54:in `match_cart': invalid regular expression; there's no previous pattern, to which '*' would define cardinality at 3: /\b*##\b/ (RegexpError)
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/rest/client.rb:506:in `any?'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:53:in `each'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:53:in `any?'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:53:in `match_cart'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:15:in `select'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:15:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:9:in `map'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cartridge_helpers.rb:9:in `check_cartridges'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/commands/cartridge.rb:79:in `add'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/commands.rb:285:in `send'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/commands.rb:285:in `execute'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/commands.rb:276:in `to_commander'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:383:in `run_active_command'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/command_runner.rb:73:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/lib/rhc/cli.rb:37:in `start'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.17.4/bin/rhc:20
	from /usr/bin/rhc:19:in `load'
	from /usr/bin/rhc:19
Comment 4 Jordan Liggitt 2013-11-13 09:40:16 EST
Specific to ruby 1.8, will add test and fix
Comment 5 Jordan Liggitt 2013-11-13 11:36:42 EST
Will merge in https://github.com/openshift/rhc/pull/511
Comment 6 openshift-github-bot 2013-11-13 13:04:33 EST
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/557c8d0e4c71782cab99b7614909fd47d5d3ca95
Fix bug 1018077: Regex-breaking cartridge name search
Comment 7 Nan Wei 2013-11-13 22:00:03 EST
Version-Release number of selected component (if applicable):
int.openshift.redhat.com
rhc 1.17.5

[weinan@dhcp-65-25 test]$ rhc app create ruby18 ruby-1.8

[weinan@dhcp-65-25 test]$ rhc cartridge add *## -a ruby18
Short Name       Full name
==========       =========
cron-1.4         Cron 1.4
jenkins-client-1 Jenkins Client
mysql-5.1        MySQL 5.1
postgresql-8.4   PostgreSQL 8.4
postgresql-9.2   PostgreSQL 9.2
haproxy-1.4      Web Load Balancer

There are no cartridges that match '*##'.

[weinan@dhcp-65-25 test]$ rhc cartridge add @##~*#####$~~~% -a ruby18
Short Name       Full name
==========       =========
cron-1.4         Cron 1.4
jenkins-client-1 Jenkins Client
mysql-5.1        MySQL 5.1
postgresql-8.4   PostgreSQL 8.4
postgresql-9.2   PostgreSQL 9.2
haproxy-1.4      Web Load Balancer

There are no cartridges that match '@##~*#####$~~~%'.

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