Bug 1129800 - [abrt] tuned-utils: powertop2tuned:86:handle_starttag:KeyError: 'id'
Summary: [abrt] tuned-utils: powertop2tuned:86:handle_starttag:KeyError: 'id'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: tuned
Version: 21
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:03529a90c22d7ea8723562b3921...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-13 17:10 UTC by Ernesto Manríquez
Modified: 2015-01-21 23:04 UTC (History)
13 users (show)

Fixed In Version: tuned-2.4.1-3.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-21 23:01:13 UTC


Attachments (Terms of Use)
File: backtrace (978 bytes, text/plain)
2014-08-13 17:10 UTC, Ernesto Manríquez
no flags Details
File: environ (2.24 KB, text/plain)
2014-08-13 17:10 UTC, Ernesto Manríquez
no flags Details
patch to fix KeyError on id attribute (455 bytes, patch)
2014-12-21 06:45 UTC, Michael Mansell
no flags Details | Diff

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.


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