Skip to content

Commit

Permalink
Improve error messages from xmlchange
Browse files Browse the repository at this point in the history
ACME users were complaining of unhelpful error messages coming
from xmlchange. This PR will make the handling of type_str consistent
with the listofsettings block above. This should ensure a better error
message.
  • Loading branch information
jgfouca committed Aug 16, 2017
1 parent 8032624 commit c8a1ace
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/Tools/xmlchange
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,26 @@ def xmlchange(caseroot, listofsettings, xmlfile, xmlid, xmlval, subgroup,
value = case.get_value(xmlid, resolved=False,
subgroup=subgroup)
xmlval = "%s %s" % (value, xmlval)

if type_str is not None and not force:
xmlval = convert_to_type(xmlval, type_str, xmlid)

if not dryrun :
if not dryrun:
newval = case.set_value(xmlid, xmlval, subgroup, ignore_type=force)
expect(newval is not None,"No variable \"%s\" found"%xmlid)
else :
else:
logger.warning("'%s' = '%s'" , xmlid , xmlval )
else:
if append:
value = case.get_value(xmlid, resolved=False, subgroup=subgroup)
xmlval = "%s %s" % (value, xmlval)

type_str = case.get_type_info(xmlid)
if not force:
if type_str is not None and not force:
xmlval = convert_to_type(xmlval, type_str, xmlid)
newval = case.set_value(xmlid, xmlval, subgroup, ignore_type=force)

expect(newval is not None,"No variable \"%s\" found"%xmlid)
newval = case.set_value(xmlid, xmlval, subgroup, ignore_type=force)
expect(newval is not None,"No variable '%s' found" % xmlid)

if not noecho:
argstr = ""
Expand Down

0 comments on commit c8a1ace

Please sign in to comment.