Bug 847306 - traceback.. remove all repos from rhua.. immediately nav to repo sync window
Summary: traceback.. remove all repos from rhua.. immediately nav to repo sync window
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA
Version: 2.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.1.1
Assignee: James Slagle
QA Contact: mkovacik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-10 13:58 UTC by wes hayutin
Modified: 2013-02-27 16:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When trying to synchronize with an already deleted repository, rhui-manager returns an unhandled exception error. This bug fix updates pulp_api.py so "None" is returned when synchronizing with a non-existent repository.
Clone Of:
Environment:
Last Closed: 2013-02-27 16:59:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (977 bytes, patch)
2013-02-12 11:01 UTC, Vitaly Kuznetsov
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0571 0 normal SHIPPED_LIVE Red Hat Update Infrastructure 2.1.1 bug fix update 2013-02-27 21:58:22 UTC

Description wes hayutin 2012-08-10 13:58:04 UTC
Description of problem:

traceback.. remove all repos from rhua.. immediately nav to repo sync window 

1. begin w/ a populated rhui env
2. remove all repos from rhui via rhui-manager
3. nav to sync window, repo sync


uccessfully connected to [ip-10-70-90-96.ec2.internal]
Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 86, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 112, in listen
    Shell.listen(self)
  File "/usr/lib/python2.6/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/sync.py", line 171, in repo_sync
    repos = self.pulp.repos_with_sync_status()
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 242, in repos_with_sync_status
    full_repo['sync_last_sync_date'] = full_repo['last_sync']
TypeError: 'NoneType' object is unsubscriptable
(END)

Comment 1 James Slagle 2012-11-29 21:23:20 UTC
the issue here is that deleting repositories is not instantaneous, yet the pulp api returns immediately even if the delete task is queued.  And a repo with a queued delete task still shows up in the list of repos.

So, you can go to the sync screen and try to sync repos and in between it getting the list of repos and checking to see if the repo can get sync'd, the repo gets deleted.

There is too much Pulp logic in rhui-manager to determine if a repo can be sync'd this should be returned by the server.  That would be quite an involved fix and given that we're still on Pulp v1, I'll go for an easier fix and just shorten the time between repos are fetched and determining if it can be sync'd.  It's not a 100% solution, but it should mostly mitigate the issue.

Comment 2 James Slagle 2012-11-29 21:25:20 UTC
commit df570e0a67dafabb7e601220e26cf1d10687e10f

Comment 3 Vitaly Kuznetsov 2013-02-05 13:14:33 UTC
I've tried to verify this bug and unfortunately ran into a slightly different issue.

Test procedure:
1) Run two rhui-manager processes in separate consoles
2) In first console:
 2.1 Add all repos from RH certificate
 2.2 Run 'Remove all repos' and immediately switch to the second console (while action is still in process)
3) In second console try to run 'sync repo'. The result is in /root/.rhui/rhui.log

Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 86, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 112, in listen
    Shell.listen(self)
  File "/usr/lib/python2.6/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/sync.py", line 171, in repo_sync
    repos = self.pulp.repos_with_sync_status()
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 239, in repos_with_sync_status
    full_repo = self.repo(repo['id'])
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 140, in repo
    raise e
ServerRequestError: (500, u'PulpException: No Repo with id: rhel-5-server-rhui-source-rpms-5Server-i386 found', u'Traceback (most recent call last):\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py", line 1052, in GET\n    return field(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py", line 1030, in keys\n    keylist = api.listkeys(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 1774, in listkeys\n    repo = self._get_existing_repo(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 117, in _get_existing_repo\n    raise PulpException("No Repo with id: %s found" % id)')

I'm not 100% sure it's the same issue though.

Comment 4 James Slagle 2013-02-06 13:56:52 UTC
If it's a different symptom of the same problem.  The repo in question got deleted in between the time it was first read, and then used (in this case, trying to get it's status).

rhui-manager is not written in a way to really handle multiple users at once.

But, I added a check for this case, so at least it won't throw an exception.

cloude commit:
2ad037f47d7c382e559a6c38b62806b5eb0acfd0

Will move to ON_QA once we get a new iso build.

Comment 5 Vitaly Kuznetsov 2013-02-12 10:50:36 UTC
RHEL-6.3-RHUI-2.1.1-20130211.0-Server-x86_64-DVD1.iso

[root@rhua ~]# rpm -q pulp
pulp-0.0.263-27.el6_3.noarch
[root@rhua ~]# rpm -q rh-rhui-tools
rh-rhui-tools-2.1.16-1.el6_3.noarch

With my test sequence (https://bugzilla.redhat.com/show_bug.cgi?id=847306#c3) the problem persists:

Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 86, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 112, in listen
    Shell.listen(self)
  File "/usr/lib/python2.6/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/sync.py", line 171, in repo_sync
    repos = self.pulp.repos_with_sync_status()
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 244, in repos_with_sync_status
    full_repo = self.repo(repo['id'])
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 145, in repo
    raise e
ServerRequestError: (500, u'PulpException: No Repo with id: rhel-6-server-rhui-supplementary-rpms-6Server-x86_64 found', u'Traceback (most recent call last):\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py", line 1052, in GET\n    return field(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py", line 1030, in keys\n    keylist = api.listkeys(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 1774, in listkeys\n    repo = self._get_existing_repo(id)\n  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 117, in _get_existing_repo\n    raise PulpException("No Repo with id: %s found" % id)')

Comment 6 Vitaly Kuznetsov 2013-02-12 11:00:38 UTC
This happens due to the typo (s,Repo,repo,) in 2ad037f47d7c382e559a6c38b62806b5eb0acfd0 cloude commit. I'll attach tiny patch (I've tested it) to fix this.

Comment 7 Vitaly Kuznetsov 2013-02-12 11:01:38 UTC
Created attachment 696463 [details]
Proposed patch

Comment 8 James Slagle 2013-02-13 19:01:14 UTC
patch applied, cloude commit 92c8c962b9a1dda9e12ac38584e7e92d1b473887

Comment 10 Vitaly Kuznetsov 2013-02-18 12:15:01 UTC
Verified in # rpm -q rh-rhui-tools
rh-rhui-tools-2.1.17-1.el6_3.noarch

no error with procedure described in https://bugzilla.redhat.com/show_bug.cgi?id=847306#c3

Comment 12 errata-xmlrpc 2013-02-27 16:59:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0571.html


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