Should read, that's NOT going to happen for rhel-7.2. sigh.
----- Original Message -----
So, I've incorporated this patch with this added.
Signed-off-by: Petr Oros <poros(a)redhat.com>
Reported-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1178917
Signed-off-by: John Kacur <jkacur(a)redhat.com>
Now, we've had a bit of discussion about refractoring.
That's going to happen for rhel7.2, so my question for Arnaldo and Petr is,
should I open a bz for the refractoring effort for rhel-7.3?
Thanks
John
----- Original Message -----
> Em Mon, May 18, 2015 at 12:30:50PM +0200, Petr Oros escreveu:
> > When /proc/sys/ path contain dot (for example netif name) and config
> > file using * for filename tuna fail with traceback:
> >
> > Invalid item! file: /proc/sys/net/ipv6/conf/tuna/1/forwarding
> > Traceback (most recent call last):
> > File "/usr/bin/tuna", line 647, in <module>
> > main()
> > File "/usr/bin/tuna", line 641, in main
> > app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered)
> > File "/usr/lib/python2.7/site-packages/tuna/tuna_gui.py", line 64,
in
> > __init__
> > self.profileview.init_default_file()
> > File "/usr/lib/python2.7/site-packages/tuna/gui/profileview.py",
line
> > 146, in init_default_file
> > self.commonview.updateCommonView()
> > File "/usr/lib/python2.7/site-packages/tuna/gui/commonview.py",
line
> > 13,
> > in updateCommonView
> > self.setup()
> > File "/usr/lib/python2.7/site-packages/tuna/gui/commonview.py",
line
> > 80,
> > in setup
> >
frameContent[catCntr]['texts'][contentCntr].set_value(int(self.config.ctlParams[catCntr][val]))
> > ValueError: invalid literal for int() with base 10: ''
> >
> > This patch add support for escaping "." character.
> >
> > Signed-off-by: Petr Oros <poros(a)redhat.com>
>
> I guess this was in response to my report, right? So it would be nice to
> have:
>
> Reported-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
> Fixes:
https://bugzilla.redhat.com/..../bz-number
>
> I will review and test later, thanks for the patch!
>
> - Arnaldo
>
>
> > ---
> > tuna/config.py | 26 ++++++++++++++++----------
> > 1 file changed, 16 insertions(+), 10 deletions(-)
> >
> > diff --git a/tuna/config.py b/tuna/config.py
> > index 77cc4d8..02c730e 100644
> > --- a/tuna/config.py
> > +++ b/tuna/config.py
> > @@ -30,6 +30,12 @@ class Config:
> > self.config[option] = value
> > self.cacheFileName = ''
> >
> > + def FileNameToConfigPath(self, filename):
> > + return filename.replace(".",
"\\.").replace("/", ".")
> > +
> > + def ConfigPathToFileName(self, configpath):
> > + return configpath.replace(".",
"/").replace("\\/", ".")
> > +
> > def updateDefault(self, filename):
> > if filename.replace("", "temp-direct-load.conf") !=
filename:
> > self.temp = ConfigParser.RawConfigParser()
> > @@ -154,9 +160,9 @@ class Config:
> > tempCfg = []
> > for index in range(len(oldTempCfg)):
> > if self.isFnString(oldTempCfg[index][0]):
> > - expanded = self.getFilesByFN("/proc/sys",
> > oldTempCfg[index][0].replace(".", "/"))
> > + expanded = self.getFilesByFN("/proc/sys",
> > self.ConfigPathToFileName(oldTempCfg[index][0]))
> > for index2 in range(len(expanded)):
> > - expandedData = (expanded[index2].replace("/",
"."),
> > oldTempCfg[index][1])
> > + expandedData = (self.FileNameToConfigPath(expanded[index2]),
> > oldTempCfg[index][1])
> > tempCfg.append(expandedData)
> > else:
> > tempCfg.append(oldTempCfg[index])
> > @@ -241,9 +247,9 @@ class Config:
> > def getSystemValue(self, filename):
> > filename = self.aliasToOriginal(filename)
> > try:
> > - buffer = open("/proc/sys/" + filename.replace(".",
"/"), 'r').read()
> > + buffer = open("/proc/sys/" +
self.ConfigPathToFileName(filename),
> > 'r').read()
> > except IOError:
> > - print _("Invalid item! file: /proc/sys/%s"
%(filename.replace(".",
> > "/")))
> > + print _("Invalid item! file: /proc/sys/%s"
> > %(self.ConfigPathToFileName(filename)))
> > return ""
> > return buffer.strip()
> >
> > @@ -253,10 +259,10 @@ class Config:
> > if value == "" or old == value:
> > return 0
> > try:
> > - fp = open("/proc/sys/" + filename.replace(".",
"/"), 'w')
> > + fp = open("/proc/sys/" + self.ConfigPathToFileName(filename),
'w')
> > fp.write(value)
> > except IOError:
> > - print "%s%s %s %s" % (_("Cant write to file! path:
/proc/sys/"),
> > filename.replace(".","/"), _("value:"), value)
> > + print "%s%s %s %s" % (_("Cant write to file! path:
/proc/sys/"),
> > self.ConfigPathToFileName(filename), _("value:"), value)
> > return -1
> > return 0
> >
> > @@ -302,9 +308,9 @@ class Config:
> > snapcont = []
> > for index in range(len(snapcontPacked)):
> > if self.isFnString(snapcontPacked[index][0]):
> > - expanded =
> >
self.getFilesByFN("/proc/sys",snapcontPacked[index][0].replace(".","/"))
> > + expanded =
> >
self.getFilesByFN("/proc/sys",self.ConfigPathToFileName(snapcontPacked[index][0]))
> > for index2 in range(len(expanded)):
> > - expandedData =
> >
(expanded[index2].replace("/","."),snapcontPacked[index][1])
> > + expandedData =
> > (self.FileNameToConfigPath(expanded[index2]),snapcontPacked[index][1])
> > snapcont.append(expandedData)
> > else:
> > snapcont.append(snapcontPacked[index])
> > @@ -348,7 +354,7 @@ class Config:
> > return msgStack
> > current = self.checkParser.items(option)
> > for opt,val in current:
> > - if not os.path.exists("/proc/sys/" +
opt.replace(".","/")) and
> >
len(self.getFilesByFN("/proc/sys/",opt.replace(".","/"))) ==
0:
> > + if not os.path.exists("/proc/sys/" +
> > self.ConfigPathToFileName(opt))
> > and len(self.getFilesByFN("/proc/sys/",
self.ConfigPathToFileName(opt)))
> > == 0:
> > msgStack = "%s%s%s\n" % (msgStack, _("Warning: File not
found:
> > /proc/sys/"), opt)
> > self.empty = False
> > if self.empty:
> > @@ -367,7 +373,7 @@ class Config:
> > self.checkParser.set('categories', '#' + option, value)
> > current = self.checkParser.items(option)
> > for opt,val in current:
> > - if not os.path.exists("/proc/sys/" + opt.replace(".",
"/")) and
> > len(self.getFilesByFN("/proc/sys/", opt.replace(".",
"/"))) == 0:
> > + if not os.path.exists("/proc/sys/" +
> > self.ConfigPathToFileName(opt))
> > and len(self.getFilesByFN("/proc/sys/",
self.ConfigPathToFileName(opt)))
> > == 0:
> > self.checkParser.remove_option(option, opt)
> > self.checkParser.set(option, '#' + opt, val)
> > except (ConfigParser.Error, IOError) as e:
> > --
> > 2.4.1
> >
> > _______________________________________________
> > tuna-devel mailing list
> > tuna-devel(a)lists.fedorahosted.org
> >
https://lists.fedorahosted.org/mailman/listinfo/tuna-devel
>