diff options
author | Mika Havela <mika.havela@gmail.com> | 2009-07-03 13:47:17 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2009-07-03 13:47:17 +0000 |
commit | 2ce8959da8f8a53d95bcee0197b42e1c642cb630 (patch) | |
tree | bcc3b814c1738f1e20dbbbb320711165bf818acc | |
parent | 6a8e9ac461eca45721f402cef4ccc76c2af64461 (diff) | |
download | acf-rrdtool-2ce8959da8f8a53d95bcee0197b42e1c642cb630.tar.bz2 acf-rrdtool-2ce8959da8f8a53d95bcee0197b42e1c642cb630.tar.xz |
Validating that at least one DS and one RRA exists
Also making it possible for 'start' and 'step' to be empty
-rw-r--r-- | rrdtool-model.lua | 10 |
1 files changed, 8 insertions, 2 deletions
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 |