From 2ce8959da8f8a53d95bcee0197b42e1c642cb630 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 3 Jul 2009 13:47:17 +0000 Subject: Validating that at least one DS and one RRA exists Also making it possible for 'start' and 'step' to be empty --- rrdtool-model.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rrdtool-model.lua') diff --git a/rrdtool-model.lua b/rrdtool-model.lua index 4e1315d..3be5a25 100644 --- a/rrdtool-model.lua +++ b/rrdtool-model.lua @@ -154,12 +154,18 @@ If you specify path, it should be " .. tostring(databases) .."/" end if (posix.stat(path)) then configfile.value.filename.errtxt = "File already exists" - elseif not tonumber(configfile.value.start.value) then + elseif (#configfile.value.start.value > 0) and not tonumber(configfile.value.start.value) then configfile.value.start.errtxt = "Only numeric values!" return configfile - elseif not tonumber(configfile.value.step.value) then + elseif (#configfile.value.step.value > 0) and not tonumber(configfile.value.step.value) then configfile.value.step.errtxt = "Only numeric values!" return configfile + elseif (#configfile.value.ds.value == 0) then + configfile.value.ds.errtxt = "You need to specify at least one DS!" + return configfile + elseif (#configfile.value.rra.value == 0) then + configfile.value.rra.errtxt = "You need to specify at least one RRA!" + return configfile else local start,step if (#configfile.value.start.value > 0) then -- cgit v1.2.3