diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-11-13 14:51:14 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-11-13 14:51:14 +0000 |
commit | 3bef7d5eb605cb56026be72d6bf7b74485252eb8 (patch) | |
tree | ecd71e516695c567a0b1a1f30aad61dbff8343d2 /provisioning-model.lua | |
parent | 7f511c1032d0f388912ad4d4e58461f52aebb0d7 (diff) | |
download | acf-provisioning-3bef7d5eb605cb56026be72d6bf7b74485252eb8.tar.bz2 acf-provisioning-3bef7d5eb605cb56026be72d6bf7b74485252eb8.tar.xz |
Allow uploading a file for bulkcreatedevices
Diffstat (limited to 'provisioning-model.lua')
-rw-r--r-- | provisioning-model.lua | 5 |
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() |