summaryrefslogtreecommitdiffstats
path: root/provisioning-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'provisioning-model.lua')
-rw-r--r--provisioning-model.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/provisioning-model.lua b/provisioning-model.lua
index bcd310f..560bc42 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -2294,6 +2294,11 @@ mymodule.get_bulk_create_request = function(self, clientdata)
end
mymodule.bulk_create_devices = function(self, devicelist)
+ -- To allow uploading a file, check the bulkdevicedata format
+ -- Haserl will pass a temporary file name if a file is uploaded
+ if #devicelist.value.bulkdevicedata.value == 1 and string.find(devicelist.value.bulkdevicedata.value[1], "^/tmp/[^.]+$") and fs.is_file(devicelist.value.bulkdevicedata.value[1]) then
+ devicelist.value.bulkdevicedata.value = fs.read_file_as_array(devicelist.value.bulkdevicedata.value[1]) or {}
+ end
local res, err = pcall(function()
local connected = databaseconnect()