Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 660439 Details for
Bug 885500
tuned ConfigParser use is broken when key contains ":"
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
use configobj to parse config file
tuned-2.1.1-configobj.patch (text/plain), 2.48 KB, created by
Fabrice Bellet
on 2012-12-09 21:12:32 UTC
(
hide
)
Description:
use configobj to parse config file
Filename:
MIME Type:
Creator:
Fabrice Bellet
Created:
2012-12-09 21:12:32 UTC
Size:
2.48 KB
patch
obsolete
>diff -uNrp tuned-2.1.1.orig/tuned/profiles/loader.py tuned-2.1.1/tuned/profiles/loader.py >--- tuned-2.1.1.orig/tuned/profiles/loader.py 2012-12-04 16:05:17.000000000 +0100 >+++ tuned-2.1.1/tuned/profiles/loader.py 2012-12-09 19:16:58.000000000 +0100 >@@ -1,5 +1,5 @@ > import tuned.profiles.profile >-import ConfigParser >+from configobj import ConfigObj > import os.path > import collections > import tuned.logs >@@ -72,17 +72,16 @@ class Loader(object): > profiles.append(profile) > > def _load_config_data(self, file_name): >- parser = ConfigParser.SafeConfigParser(allow_no_value=True) >- try: >- parser.read(file_name) >- except ConfigParser.Error as e: >+ try: >+ config_obj = ConfigObj(file_name, raise_errors=True) >+ except ConfigObjError as e: > raise InvalidProfileException("Cannot parse '%s'." % file_name, e) > > config = collections.OrderedDict() >- for section in parser.sections(): >+ for section in config_obj.keys(): > config[section] = collections.OrderedDict() >- for option, value in parser.items(section): >- config[section][option] = value >+ for option in config_obj[section].keys(): >+ config[section][option] = config_obj[section][option] > > # TODO: HACK, this needs to be solved in a better way (better config parser) > for unit_name in config: >diff -uNrp tuned-2.1.1.orig/tuned/utils/commands.py tuned-2.1.1/tuned/utils/commands.py >--- tuned-2.1.1.orig/tuned/utils/commands.py 2012-12-04 16:05:17.000000000 +0100 >+++ tuned-2.1.1/tuned/utils/commands.py 2012-12-09 19:16:30.000000000 +0100 >@@ -2,7 +2,7 @@ import tuned.logs > import copy > import os > import tuned.consts as consts >-import ConfigParser >+from configobj import ConfigObj > import re > from subprocess import * > >@@ -63,15 +63,11 @@ def get_active_option(options, dosplit = > def recommend_profile(): > profile = consts.DEFAULT_PROFILE > for f in consts.LOAD_DIRECTORIES: >- parser = ConfigParser.SafeConfigParser(allow_no_value = False) >- try: >- parser.read(os.path.join(f, consts.AUTODETECT_FILE)) >- except: >- continue >- for section in reversed(parser.sections()): >+ config = ConfigObj(os.path.join(f, consts.AUTODETECT_FILE)) >+ for section in reversed(config.keys()): > match1 = match2 = True >- for option, value in parser.items(section): >- value = str(value) >+ for option in config[section].keys(): >+ value = config[section][option] > if value == "": > value = r"^$" > if option == "virt":
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 885500
: 660439 |
660676