diff options
-rwxr-xr-x | cgi-bin/provisioning.cgi | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/cgi-bin/provisioning.cgi b/cgi-bin/provisioning.cgi index e4c9303..1f86aa6 100755 --- a/cgi-bin/provisioning.cgi +++ b/cgi-bin/provisioning.cgi @@ -118,11 +118,9 @@ if ( request_method == "GET" ) then log:write("Checking PROV Table for results\n") -- Load the ACF mvc mvc = require("acf.mvc") - -- We'll use the cli controller, but change the view resolver to call the template - local pathinfo = ENV.PATH_INFO - FRAMEWORK=mvc:new() - FRAMEWORK:read_config("acf") - APP=FRAMEWORK:new("acf_cli") + -- We'll change the view resolver to call the template + APP=mvc:new() + APP:read_config("acf") APP.view_resolver = function(self) return function (data) if not data.errtxt and data.value.values and data.value.values.value.device and data.value.values.value.device.template then @@ -134,15 +132,11 @@ if ( request_method == "GET" ) then end end end - -- Set up the action and parameters - ENV.PATH_INFO = "/provisioning/provisioning/getfile" - APP.clientdata = {mac=mac, ip=ip_address, agent=user_agent} + -- Set up the parameters + local clientdata = {mac=mac, ip=ip_address, agent=user_agent} -- Dispatch the command - APP:dispatch() + APP:dispatch("/provisioning/", "provisioning", "getfile", clientdata) APP:destroy() - FRAMEWORK:destroy() - - ENV.PATH_INFO = pathinfo elseif ( request_method == "PUT" ) then local data = io.stdin:read("*all") local success = true @@ -161,11 +155,9 @@ elseif ( request_method == "PUT" ) then log:write("Checking PROV Table for results\n") -- Load the ACF mvc mvc = require("acf.mvc") - -- We'll use the cli controller, but change the view resolver to report HTTP code - local pathinfo = ENV.PATH_INFO - FRAMEWORK=mvc:new() - FRAMEWORK:read_config("acf") - APP=FRAMEWORK:new("acf_cli") + -- We'll change the view resolver to report HTTP code + APP=mvc:new() + APP:read_config("acf") APP.view_resolver = function(self) return function (output) if output.errtxt then @@ -177,14 +169,10 @@ elseif ( request_method == "PUT" ) then end end -- Set up the action and parameters - ENV.PATH_INFO = "/provisioning/provisioning/putfile" - APP.clientdata = {mac=mac, data=data} + local clientdata = {mac=mac, data=data} -- Dispatch the command - APP:dispatch() + APP:dispatch("/provisioning/", "provisioning", "putfile", clientdata) APP:destroy() - FRAMEWORK:destroy() - - ENV.PATH_INFO = pathinfo end if success then local path = root..path_info |