summaryrefslogtreecommitdiffstats
path: root/provisioning-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2015-12-07 17:19:27 +0000
committerTed Trask <ttrask01@yahoo.com>2015-12-07 17:19:27 +0000
commitcb0e2a43db75096c672ce11bde227b9972973f1f (patch)
tree037b2fd332614fe5e2178f557e852a3e6f9d3190 /provisioning-model.lua
parente75038abf8eb7715cf89c13d1595e314dd07c127 (diff)
downloadacf-provisioning-cb0e2a43db75096c672ce11bde227b9972973f1f.tar.bz2
acf-provisioning-cb0e2a43db75096c672ce11bde227b9972973f1f.tar.xz
Allow bulkcreatedevices to use exact match to label for select option
Diffstat (limited to 'provisioning-model.lua')
-rw-r--r--provisioning-model.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 0a86e97..40603c6 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -2420,9 +2420,12 @@ mymodule.bulk_create_devices = function(self, devicelist)
end
end
if not found then
- -- Check for string match
+ -- Check for string match to label
for k,c in ipairs(class.option) do
- if string.find(c.label, format.escapemagiccharacters(value)) then
+ if c.label == value then
+ found = c.value
+ break
+ elseif string.find(c.label, format.escapemagiccharacters(value)) then
if found then
error("Ambiguous "..name.." class in line "..i)
end
@@ -2461,7 +2464,7 @@ mymodule.bulk_create_devices = function(self, devicelist)
-- Allow the select value to be the value or a unique substring of the label
local found = false
for k,o in ipairs(params.value[class].value[param].option) do
- if values[j] == o.value then
+ if values[j] == o.value or values[j] == o.label then
found = o.value
break
elseif values[j] ~= "" and string.find(o.label, format.escapemagiccharacters(values[j])) then