Project

Profile

Help

Issue #1605

closed

Client-side exception when retrieving erratum that does not exist

Added by amacdona@redhat.com almost 7 years ago. Updated over 3 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

When searching for errata within a repository, if the specified erratum-id does not exist, the CLI raises an IndexError.

pulp-admin -vv rpm repo content errata --repo-id app --erratum-id doesnotexist
(pulp_rpm)[vagrant@dev pulp_rpm]$ pulp-admin -vv rpm repo content errata --repo-id app --erratum-id doesnotexist2016-01-30 13:42:45,555 - DEBUG - sending POST request to /pulp/api/v2/repositories/app/search/units/
2016-01-30 13:42:45,586 - INFO - POST request to /pulp/api/v2/repositories/app/search/units/ with parameters {"criteria": {"type_ids": ["erratum"], "filters": {"unit": {"id": "doesnotexist"}}}}
2016-01-30 13:42:45,586 - INFO - Response status : 200 

2016-01-30 13:42:45,586 - INFO - Response body :
 []

2016-01-30 13:42:45,586 - ERROR - Client-side exception occurred
Traceback (most recent call last):
  File "/home/vagrant/devel/pulp/client_lib/pulp/client/extensions/core.py", line 474, in run
    exit_code = Cli.run(self, args)
  File "/usr/lib/python2.7/site-packages/okaara/cli.py", line 974, in run
    exit_code = command_or_section.execute(self.prompt, remaining_args)
  File "/home/vagrant/devel/pulp/client_lib/pulp/client/extensions/extensions.py", line 210, in execute
    return self.method(*arg_list, **clean_kwargs)
  File "/home/vagrant/devel/pulp_rpm/extensions_admin/pulp_rpm/extensions/admin/contents.py", line 413, in errata
    self.run_search([TYPE_ERRATUM], self.write_erratum_detail, **new_kwargs)
  File "/home/vagrant/devel/pulp_rpm/extensions_admin/pulp_rpm/extensions/admin/contents.py", line 169, in run_search
    out_func(units, FIELDS_BY_TYPE[type_ids[0]])
  File "/home/vagrant/devel/pulp_rpm/extensions_admin/pulp_rpm/extensions/admin/contents.py", line 432, in write_erratum_detail
    erratum_meta = erratum_list[0]
IndexError: list index out of range
An unexpected error has occurred. More information may be found using the -v
flag.

Note, API call returns as expected:

(pulp_rpm)[vagrant@dev pulp_rpm]$ http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/app/search/units/ criteria:='{"type_ids": ["erratum"],"filters":{"unit":{"id": "doesnotexist"}}}'
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Sat, 30 Jan 2016 18:45:37 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.17 (Fedora) OpenSSL/1.0.1k-fips mod_wsgi/4.4.8 Python/2.7.10

[]

Also available in: Atom PDF