Bug 1714925 - KeyError: 'anonymous'
Summary: KeyError: 'anonymous'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-easy-karma
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Till Maas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1716043 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-29 08:19 UTC by Kamil Páral
Modified: 2019-07-05 03:17 UTC (History)
10 users (show)

Fixed In Version: fedora-easy-karma-0-0.41.20181206gitb6d97e0.fc30 fedora-easy-karma-0-0.41.20181206gitb6d97e0.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-04 01:55:08 UTC


Attachments (Terms of Use)

Description Kamil Páral 2019-05-29 08:19:24 UTC
Description of problem:
With the release of bodhi 4.0, there's no longer support for anonymous comments, and the API changed. FEK now crashes every time.

$ fedora-easy-karma 
Getting list of installed packages...
Waiting for Bodhi for a list of packages in updates-testing (F30)...
Fetching updates page 2 of 12
...
Fetching updates page 12 of 12
found 286 testing updates
Traceback (most recent call last):
  File "/usr/bin/fedora-easy-karma", line 851, in <module>
    fek = FedoraEasyKarma()
  File "/usr/bin/fedora-easy-karma", line 628, in __init__
    self.already_commented(update, self.options.fas_username):
  File "/usr/bin/fedora-easy-karma", line 776, in already_commented
    if not comment["anonymous"] and comment["user"]["name"] == user:
KeyError: 'anonymous'


Version-Release number of selected component (if applicable):
fedora-easy-karma-0-0.40.20181206gitb6d97e0.fc30.noarch

How reproducible:
always

Comment 1 Till Maas 2019-05-29 14:03:02 UTC
Does using the Bodhi 4 client from
https://copr.fedorainfracloud.org/coprs/bowlofeggs/bodhi/
fix this or does this need code changes in fedora-easy-karma? Can you maybe test it?

Comment 2 Miro Hrončok 2019-05-29 15:48:02 UTC
Replacing both comment["anonymous"] with comment.get("anonymous", False) workarounds the immediate issue.

But that just leads to:

Traceback (most recent call last):
  File "/usr/bin/fedora-easy-karma", line 851, in <module>
    fek = FedoraEasyKarma()
  File "/usr/bin/fedora-easy-karma", line 656, in __init__
    update["submitter"] == self.options.fas_username:
KeyError: 'submitter'

Comment 3 Miro Hrončok 2019-05-29 15:54:44 UTC
An update dict now looks like this:

{'alias': 'FEDORA-2019-ac3a8134ef',
 'autokarma': True,
 'bugs': [],
 'builds': [{'epoch': 0,
             'nvr': '389-ds-base-1.4.1.3-1.fc30',
             'release_id': 28,
             'signed': True,
             'type': 'rpm'}],
 'close_bugs': True,
 'comments': [{'bug_feedback': [],
               'id': 950165,
               'karma': 0,
               'karma_critpath': 0,
               'testcase_feedback': [],
               'text': 'This update has been submitted for testing by '
                       'mreynolds. ',
               'timestamp': '2019-05-24 20:46:05',
               'update_id': 139937,
               'user': {'avatar': 'https://apps.fedoraproject.org/img/icons/bodhi-24.png',
                        'email': None,
                        'groups': [],
                        'id': 91,
                        'name': 'bodhi',
                        'openid': 'bodhi.id.fedoraproject.org'},
               'user_id': 91},
              {'bug_feedback': [],
               'id': 950416,
               'karma': 0,
               'karma_critpath': 0,
               'testcase_feedback': [],
               'text': 'This update has been pushed to testing.',
               'timestamp': '2019-05-25 01:52:03',
               'update_id': 139937,
               'user': {'avatar': 'https://apps.fedoraproject.org/img/icons/bodhi-24.png',
                        'email': None,
                        'groups': [],
                        'id': 91,
                        'name': 'bodhi',
                        'openid': 'bodhi.id.fedoraproject.org'},
               'user_id': 91}],
 'compose': None,
 'content_type': 'rpm',
 'critpath': False,
 'date_approved': None,
 'date_modified': None,
 'date_pushed': '2019-05-25 01:50:41',
 'date_stable': None,
 'date_submitted': '2019-05-24 20:46:05',
 'date_testing': '2019-05-25 01:50:41',
 'display_name': '',
 'karma': 0,
 'locked': False,
 'meets_testing_requirements': False,
 'notes': 'Bump version to 1.4.1.3',
 'pushed': True,
 'release': {'branch': 'f30',
             'candidate_tag': 'f30-updates-candidate',
             'composed_by_bodhi': True,
             'composes': [],
             'dist_tag': 'f30',
             'id_prefix': 'FEDORA',
             'long_name': 'Fedora 30',
             'mail_template': 'fedora_errata_template',
             'name': 'F30',
             'override_tag': 'f30-override',
             'pending_signing_tag': 'f30-signing-pending',
             'pending_stable_tag': 'f30-updates-pending',
             'pending_testing_tag': 'f30-updates-testing-pending',
             'stable_tag': 'f30-updates',
             'state': 'current',
             'testing_tag': 'f30-updates-testing',
             'version': '30'},
 'request': None,
 'require_bugs': True,
 'require_testcases': True,
 'requirements': '',
 'severity': 'unspecified',
 'stable_karma': 1,
 'status': 'testing',
 'suggest': 'unspecified',
 'test_cases': [{'name': 'QA:Testcase 389 ds base setup testcase',
                 'package_id': 377},
                {'name': 'QA:Testcase Create normalized dn cache testcase',
                 'package_id': 377},
                {'name': 'QA:Testcase Create normalized dn cache testcase2',
                 'package_id': 377}],
 'test_gating_status': 'ignored',
 'title': '389-ds-base-1.4.1.3-1.fc30',
 'type': 'bugfix',
 'unstable_karma': -1,
 'updateid': 'FEDORA-2019-ac3a8134ef',
 'url': 'https://bodhi.fedoraproject.org/updates/FEDORA-2019-ac3a8134ef',
 'user': {'avatar': 'https://seccdn.libravatar.org/avatar/91c229394c868a53f7014d94442b38fd77a2e060a07eeaa6c0d562c86b25c24e?s=24&d=retro',
          'email': 'mreynolds@redhat.com',
          'groups': [Munch({'name': 'packager'})],
          'id': 1553,
          'name': 'mreynolds',
          'openid': 'mreynolds.id.fedoraproject.org'}}

Comment 4 Randy Barlow 2019-05-29 16:39:15 UTC
Miro,

['submitter'] can be replaced with ['user']['name'], and I think that will actually also be compatible with the Bodhi 3 server which is a nice bonus.

The problem with the proposal to assume anonymous is False is that Bodhi server does still retain historic anonymous comments and it will incorrectly mark those as false in the client. You can tell they are anonymous still by looking for the username 'anonymous' as the author of the comment, which would be a more complete fix.

Comment 5 Randy Barlow 2019-05-29 16:40:09 UTC
Also this is very likely a Bodhi bug and not a f-e-k bug. See https://bugzilla.redhat.com/show_bug.cgi?id=1714950. We likely want to close this and track it over there.

Comment 6 Fedora Update System 2019-06-03 21:48:42 UTC
FEDORA-2019-352078fd2b has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-352078fd2b

Comment 7 Fedora Update System 2019-06-03 21:48:53 UTC
FEDORA-2019-5ce9adadc1 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5ce9adadc1

Comment 8 Fedora Update System 2019-06-04 01:18:00 UTC
bodhi-4.0.2-1.fc30, bodhi3-3.14.0-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-352078fd2b

Comment 9 Fedora Update System 2019-06-04 03:27:49 UTC
bodhi-4.0.2-1.fc29, bodhi3-3.12.0-200.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5ce9adadc1

Comment 10 Kamil Páral 2019-06-04 08:14:50 UTC
(In reply to Fedora Update System from comment #6)
> FEDORA-2019-352078fd2b has been submitted as an update to Fedora 30.
> https://bodhi.fedoraproject.org/updates/FEDORA-2019-352078fd2b

This does not fix this particular traceback.

Comment 11 Randy Barlow 2019-06-04 15:27:33 UTC
Oh I see why - I didn't notice that Bodhi code is actually not in the traceback - it looks like f-e-k itself is expecting the anonymous key, which is no longer part of the Bodhi API in Bodhi 4.

I will unmark the updates as fixing this, and sorry for the confusion!

Comment 12 Randy Barlow 2019-06-04 15:31:45 UTC
It's this line:

https://pagure.io/fedora-easy-karma/blob/master/f/fedora-easy-karma.py#_193

Bodhi no longer has anonymous comments, so I think we can just drop that code from there. If you want to process historic comments, the "anonymous" username can be used to detect them.

Comment 13 Miro Hrončok 2019-07-02 21:22:22 UTC
https://pagure.io/fedora-easy-karma/pull-request/8

Comment 14 Miro Hrončok 2019-07-02 21:22:52 UTC
*** Bug 1716043 has been marked as a duplicate of this bug. ***

Comment 15 Fedora Update System 2019-07-03 13:08:35 UTC
FEDORA-2019-27bac720d8 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-27bac720d8

Comment 16 Fedora Update System 2019-07-03 13:09:15 UTC
FEDORA-2019-793e240ce0 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-793e240ce0

Comment 17 Fedora Update System 2019-07-04 01:55:08 UTC
fedora-easy-karma-0-0.41.20181206gitb6d97e0.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2019-07-04 03:10:59 UTC
fedora-easy-karma-0-0.41.20181206gitb6d97e0.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-793e240ce0

Comment 19 Fedora Update System 2019-07-05 03:17:39 UTC
fedora-easy-karma-0-0.41.20181206gitb6d97e0.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


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