From: Ondrej Lichtner olichtne@redhat.com
When the third parameter of template function ip was negative it would produce an IndexError exception instead of XmlTemplateError. This commit fixes that.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- Common/XmlTemplates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Common/XmlTemplates.py b/Common/XmlTemplates.py index 6afcc05..9a62481 100644 --- a/Common/XmlTemplates.py +++ b/Common/XmlTemplates.py @@ -234,7 +234,7 @@ class XmlTemplates: msg = "Second parameter of function ip() is invalid: "\ "Interface %s does not exist." % if_id raise XmlTemplateError(msg) - if ip_id >= len(machine['netconfig'][if_id]['addresses']): + if ip_id >= len(machine['netconfig'][if_id]['addresses']) or ip_id < 0: msg = "Third parameter of function ip() is invalid: "\ "Address %s does not exist." % ip_id raise XmlTemplateError(msg)
lnst-developers@lists.fedorahosted.org