Bug 669520

Summary: Need a cleaner error message in package search when specifying an invalid regex
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: z_otherAssignee: James Slagle <jslagle>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: jconnor, jmatthew, jslagle, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 25   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 12:09:53 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:
Bug Depends On:    
Bug Blocks: 647488, 673021    

Description Jay Dobies 2011-01-13 21:11:07 UTC
$ pulp-admin package search --version '*foo'
error: operation failed: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 57, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/role_check.py", line 131, in check_roles
    result = f(instance, *fargs, **kw)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/services.py", line 100, in PUT
    release=release, arch=arch, filename=filename, regex=True)
  File "/usr/lib/python2.7/site-packages/pulp/server/api/package.py", line 103, in packages
    searchDict['version'] = {"$regex":re.compile(version)}
  File "/usr/lib64/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.7/re.py", line 245, in _compile
    raise error, v # invalid expression
error: nothing to repeat

Comment 1 Sayli Karmarkar 2011-03-14 22:59:11 UTC
Part of this is fixed by because of jconnor and jmatthews's fixes for server side
traceback. However, it error message should state that regex is invalid instead of following message:

$ sudo pulp-admin package search --version '*foo'
error: operation failed: error: nothing to repeat

Comment 2 James Slagle 2011-06-15 20:29:29 UTC
I committed a fix for this in commit 0122bb4fb545dba3b065734b6b6c997a23535e09.  There should now be a more friendly error like:
error: operation failed: RegularExpressionError: "The regular expression '*3.11' is not valid: nothing to repeat"

Comment 3 Jeff Ortel 2011-06-17 21:10:09 UTC
build: 0.192

Comment 4 Preethi Thomas 2011-07-06 17:03:31 UTC
[root@preethi ~]# rpm -q pulp
pulp-0.0.200-1.fc14.noarch

[root@preethi ~]# pulp-admin package search --version '*foo'
error: operation failed: RegularExpressionError: "The regular expression '*foo' is not valid: nothing to repeat"

Comment 5 Preethi Thomas 2011-08-16 12:09:53 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 6 Preethi Thomas 2011-08-16 12:22:10 UTC
Closing with Community Release 15

pulp-0.0.223-4.