forked from OpenPDU/acf-openpdu
added config file editing capabilities
This commit is contained in:
4
README
4
README
@@ -9,10 +9,10 @@ DONE:
|
||||
* Power control (ON/OFF) for each socket
|
||||
* All the outlets are powered ON on boot
|
||||
* ACF package
|
||||
* configuration file
|
||||
* configuration file editing
|
||||
|
||||
TODO:
|
||||
* editing socket parameters
|
||||
* editing outlet parameters
|
||||
* everything else (there's a long list)
|
||||
|
||||
BUGS:
|
||||
|
||||
@@ -16,4 +16,8 @@ mymodule.poweroff = function(self)
|
||||
return self.handle_form(self, self.model.get_setpower, self.model.setpoweroff, self.clientdata, "commitpower", "Action result")
|
||||
end
|
||||
|
||||
function mymodule.expert(self)
|
||||
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Config File", "Configuration Set")
|
||||
end
|
||||
|
||||
return mymodule
|
||||
|
||||
1
acf-app/openpdu-expert-html.lsp
Symbolic link
1
acf-app/openpdu-expert-html.lsp
Symbolic link
@@ -0,0 +1 @@
|
||||
../expert-html.lsp
|
||||
@@ -5,6 +5,7 @@ fs = require("acf.fs")
|
||||
json = require('cjson')
|
||||
modelfunctions = require("modelfunctions")
|
||||
|
||||
local configfile = "/etc/openpdu/openpdu.conf"
|
||||
local s = modelfunctions.run_executable({"/usr/bin/openpdu", "outlets", "-j"})
|
||||
local o = json.decode(s)
|
||||
local outlets = {}
|
||||
@@ -46,4 +47,12 @@ mymodule.setpoweroff = function(self, r)
|
||||
return r
|
||||
end
|
||||
|
||||
function mymodule.get_filedetails()
|
||||
return modelfunctions.getfiledetails(configfile)
|
||||
end
|
||||
|
||||
function mymodule.update_filedetails(self, filedetails)
|
||||
return modelfunctions.setfiledetails(self, filedetails, {configfile})
|
||||
end
|
||||
|
||||
return mymodule
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
#CAT GROUP/DESC TAB ACTION
|
||||
Applications 20OpenPDU Status status
|
||||
Applications 20OpenPDU Expert expert
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
USER=openpdu:status
|
||||
EDITOR=openpdu:status
|
||||
EXPERT=openpdu:status
|
||||
ADMIN=openpdu:status,openpdu:edit,openpdu:power,openpdu:poweron,openpdu:poweroff
|
||||
EXPERT=openpdu:status,openpdu:expert
|
||||
ADMIN=openpdu:status,openpdu:edit,openpdu:expert,openpdu:power,openpdu:poweron,openpdu:poweroff
|
||||
|
||||
Reference in New Issue
Block a user