Bug 1129800

Summary: [abrt] tuned-utils: powertop2tuned:86:handle_starttag:KeyError: 'id'
Product: [Fedora] Fedora Reporter: Ernesto Manríquez <alejandronova>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: alejandronova, duvelle.jones, evan, fredoche, jclaverogarcia, jkaluza, jskarvad, jv+fedora, leerkotte123, michael.mansell, pknirsch, twoerner, vamem9z
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/c12007663a42251ccf9e36c3ce20a0bf5254f77d
Whiteboard: abrt_hash:03529a90c22d7ea8723562b3921cf622d8baa1c2
Fixed In Version: tuned-2.4.1-3.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 23:01:13 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:
Attachments:
Description Flags
File: backtrace
none
File: environ
none
patch to fix KeyError on id attribute none

Description Ernesto Manríquez 2014-08-13 17:10:14 UTC
Description of problem:
This happened while using powertop2tuned, to write a custom tuned policy based on powertop.

Powertop 2.6.1, Fedora 21 alpha 0 (branched).

Version-Release number of selected component:
tuned-utils-2.3.0-4.fc21

Additional info:
reporter:       libreport-2.2.3
cmdline:        /usr/bin/python -Es /bin/powertop2tuned -e battery
dso_list:       python-libs-2.7.8-3.fc21.x86_64
executable:     /bin/powertop2tuned
kernel:         3.16.0-1.fc21.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
powertop2tuned:86:handle_starttag:KeyError: 'id'

Traceback (most recent call last):
  File "/bin/powertop2tuned", line 321, in <module>
    sys.exit(p.generate(args['new_profile'], args['merge_profile'], args['enable']))
  File "/bin/powertop2tuned", line 263, in generate
    data, plugins = self.parseHTML(enable_tunings)
  File "/bin/powertop2tuned", line 224, in parseHTML
    parser.feed(data)
  File "/usr/lib64/python2.7/HTMLParser.py", line 117, in feed
    self.goahead(0)
  File "/usr/lib64/python2.7/HTMLParser.py", line 161, in goahead
    k = self.parse_starttag(i)
  File "/usr/lib64/python2.7/HTMLParser.py", line 327, in parse_starttag
    self.handle_starttag(tag, attrs)
  File "/bin/powertop2tuned", line 86, in handle_starttag
    if self.lastStartTag == "div" and dict(attrs)["id"]  == "tuning":
KeyError: 'id'

Local variables in innermost frame:
self: <__main__.PowertopHTMLParser instance at 0x7f2104e30ea8>
tag: u'div'
attrs: [(u'class', u'sys_info')]

Comment 1 Ernesto Manríquez 2014-08-13 17:10:17 UTC
Created attachment 926536 [details]
File: backtrace

Comment 2 Ernesto Manríquez 2014-08-13 17:10:18 UTC
Created attachment 926537 [details]
File: environ

Comment 3 fred 2014-10-12 22:44:29 UTC
Another user experienced a similar problem:

I was trying to run the powertop2tuned script, like I do after any reinstall. But it failed.

reporter:       libreport-2.2.3
cmdline:        /usr/bin/python -Es /usr/bin/powertop2tuned -m powersave -o monprofil
dso_list:       python-libs-2.7.8-4.1.fc21.x86_64
executable:     /usr/bin/powertop2tuned
kernel:         3.16.1-301.fc21.x86_64
package:        tuned-utils-2.4.0-1.fc21
reason:         powertop2tuned:86:handle_starttag:KeyError: 'id'
runlevel:       N 5
type:           Python
uid:            0

Comment 4 Michael Mansell 2014-12-21 06:45:30 UTC
Created attachment 971644 [details]
patch to fix KeyError on id attribute

This patched fixes the KeyError when running the powertop2tuned script.

According to https://wiki.python.org/moin/KeyError the get method does not throw an error but instead returns a default value.  The script continues to run as expected after applying this patch.

Comment 5 Jaroslav Škarvada 2015-01-09 14:53:42 UTC
(In reply to Michael Mansell from comment #4)
> Created attachment 971644 [details]
> patch to fix KeyError on id attribute
> 
Thanks, applied upstream:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=4a0a965f6507b5a626bf19b5c235097cadd8d0e5

Comment 6 Fedora Update System 2015-01-09 15:27:28 UTC
tuned-2.4.1-3.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/tuned-2.4.1-3.fc21

Comment 7 Fedora Update System 2015-01-09 15:35:54 UTC
tuned-2.4.1-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/tuned-2.4.1-3.fc20

Comment 8 Moses 2015-01-09 17:26:47 UTC
Another user experienced a similar problem:

I attempted to create a new tuned profie using power2tuned. I tried to commands sudo powertop2tuned ptop and sudo powertop2tuned -n ptop both gave the following:


reporter:       libreport-2.3.0
cmdline:        /usr/bin/python -Es /bin/powertop2tuned ptop
dso_list:       python-libs-2.7.8-7.fc21.x86_64
executable:     /bin/powertop2tuned
kernel:         3.17.7-300.fc21.x86_64
package:        tuned-utils-2.4.1-1.fc21
reason:         powertop2tuned:86:handle_starttag:KeyError: 'id'
runlevel:       N 5
type:           Python
uid:            0

Comment 9 Fedora Update System 2015-01-10 02:58:16 UTC
Package tuned-2.4.1-3.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing tuned-2.4.1-3.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0481/tuned-2.4.1-3.fc21
then log in and leave karma (feedback).

Comment 10 Moses 2015-01-12 15:29:20 UTC
I can confirm the update tuned-2.4.1-3.fc2 and tuned-utils-2.4.1-3.fc21 works.

Comment 11 Jaroslav Škarvada 2015-01-12 15:38:37 UTC
(In reply to Moses from comment #10)
> I can confirm the update tuned-2.4.1-3.fc2 and tuned-utils-2.4.1-3.fc21
> works.

Ok, thanks for info, please give it positive karma, if you can.

Comment 12 Fedora Update System 2015-01-21 23:01:13 UTC
tuned-2.4.1-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2015-01-21 23:04:11 UTC
tuned-2.4.1-3.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.