Skip to content

Commit

Permalink
pmconfig: harden parsing of invalid configuration settings
Browse files Browse the repository at this point in the history
A mistaken configuration setting (instances = no) releaved an issue
with parsing invalid or unexpected configurations. Add an obvious
quick fix which is good for now but the method might need to be
fully reviewed later and some QA added to better define and handle
how to deal with invalid or mistaken configuration entries.
  • Loading branch information
myllynen committed Jul 3, 2024
1 parent 253a314 commit c527872
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/python/pcp/pmconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def set_attr(self, name, value):
if name == 'speclocal':
self.util.speclocal = value
elif name == 'derived':
if value.find(';') != -1:
self.util.derived = value
if str(value).find(';') != -1:
self.util.derived = str(value)
else:
self.util.derived = value.replace(",", ";")
self.util.derived = str(value).replace(",", ";")
elif name == 'samples':
self.util.opts.pmSetOptionSamples(value)
self.util.samples = self.util.opts.pmGetOptionSamples()
Expand All @@ -189,7 +189,7 @@ def set_attr(self, name, value):
else:
self.util.type_prefer = 0
elif name == 'instances':
self.util.instances = value.split(",")
self.util.instances = str(value).split(",")
else:
try:
setattr(self.util, name, int(value))
Expand Down

0 comments on commit c527872

Please sign in to comment.