initial global booleans and tunables support. also fix index
building, as it was being rebuilt for every module, rather then once after all modules are loaded.
This commit is contained in:
parent
a42ca7ebec
commit
249d461f23
8
refpolicy/doc/templates/global_bool_list.html
vendored
Normal file
8
refpolicy/doc/templates/global_bool_list.html
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<h3>Global booleans:</h3>
|
||||||
|
|
||||||
|
[[for bool in booleans]]
|
||||||
|
<div id="interfacesmall">
|
||||||
|
Name: [[bool['bool_name']]]<p/>
|
||||||
|
Default Value: [[bool['def_val']]]<p/>
|
||||||
|
</div>
|
||||||
|
[[end]]
|
8
refpolicy/doc/templates/global_tun_list.html
vendored
Normal file
8
refpolicy/doc/templates/global_tun_list.html
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<h3>Global tunables:</h3>
|
||||||
|
|
||||||
|
[[for tun in tunables]]
|
||||||
|
<div id="interfacesmall">
|
||||||
|
Name: [[tun['tun_name']]]<p/>
|
||||||
|
Default Value: [[tun['def_val']]]<p/>
|
||||||
|
</div>
|
||||||
|
[[end]]
|
8
refpolicy/doc/templates/menu.html
vendored
8
refpolicy/doc/templates/menu.html
vendored
@ -10,9 +10,13 @@
|
|||||||
</div>
|
</div>
|
||||||
[[end]]
|
[[end]]
|
||||||
<br/><p/>
|
<br/><p/>
|
||||||
|
<a href="global_booleans.html">* Global Booleans </a>
|
||||||
|
<br/><p/>
|
||||||
|
<a href="global_tunables.html">* Global Tunables </a>
|
||||||
|
<p/><br/><p/>
|
||||||
<a href="index.html">* Layer Index</a>
|
<a href="index.html">* Layer Index</a>
|
||||||
<br/><p/>
|
<br/><p/>
|
||||||
<a href="interfaces.html">* Interface Index</a>
|
<a href="interfaces.html">* Interface Index</a>
|
||||||
<br/><p/>
|
<br/><p/>
|
||||||
<a href="templates.html">* Template Index</a>
|
<a href="templates.html">* Template Index</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -185,6 +185,19 @@ def temp_cmp(a, b):
|
|||||||
|
|
||||||
return cmp(a["template_name"], b["template_name"])
|
return cmp(a["template_name"], b["template_name"])
|
||||||
|
|
||||||
|
def tun_cmp(a, b):
|
||||||
|
"""
|
||||||
|
Compares two tunables.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return cmp(a["tun_name"], b["tun_name"])
|
||||||
|
def bool_cmp(a, b):
|
||||||
|
"""
|
||||||
|
Compares two booleans.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return cmp(a["bool_name"], b["bool_name"])
|
||||||
|
|
||||||
def gen_doc_menu(mod_layer, module_list):
|
def gen_doc_menu(mod_layer, module_list):
|
||||||
"""
|
"""
|
||||||
Generates the HTML document menu.
|
Generates the HTML document menu.
|
||||||
@ -277,6 +290,12 @@ def gen_docs(doc, working_dir, templatedir):
|
|||||||
templistfile = open(templatedir + "/temp_list.html", "r")
|
templistfile = open(templatedir + "/temp_list.html", "r")
|
||||||
templistdata = templistfile.read()
|
templistdata = templistfile.read()
|
||||||
templistfile.close()
|
templistfile.close()
|
||||||
|
boollistfile = open(templatedir + "/global_bool_list.html", "r")
|
||||||
|
boollistdata = boollistfile.read()
|
||||||
|
boollistfile.close()
|
||||||
|
tunlistfile = open(templatedir + "/global_tun_list.html", "r")
|
||||||
|
tunlistdata = tunlistfile.read()
|
||||||
|
tunlistfile.close()
|
||||||
except:
|
except:
|
||||||
error("Could not open templates")
|
error("Could not open templates")
|
||||||
|
|
||||||
@ -539,6 +558,52 @@ def gen_docs(doc, working_dir, templatedir):
|
|||||||
body_tpl.execute(temp_fh, body_args)
|
body_tpl.execute(temp_fh, body_args)
|
||||||
temp_fh.close()
|
temp_fh.close()
|
||||||
|
|
||||||
|
|
||||||
|
#build the global tunable index
|
||||||
|
global_tun_buf = []
|
||||||
|
for tunable in doc.getElementsByTagName("tunable"):
|
||||||
|
if tunable.parentNode.nodeName == "policy":
|
||||||
|
tunable_name = tunable.getAttribute("name")
|
||||||
|
default_value = tunable.getAttribute("dftval")
|
||||||
|
global_tun_buf.append( { "tun_name" : tunable_name,
|
||||||
|
"def_val" : default_value } )
|
||||||
|
global_tun_buf.sort(tun_cmp)
|
||||||
|
global_tun_tpl = pyplate.Template(tunlistdata)
|
||||||
|
global_tun_buf = global_tun_tpl.execute_string({"tunables" : global_tun_buf})
|
||||||
|
global_tun_file = "global_tunables.html"
|
||||||
|
global_tun_fh = open(global_tun_file, "w")
|
||||||
|
body_tpl = pyplate.Template(bodydata)
|
||||||
|
|
||||||
|
body_args = { "menu" : menu_buf,
|
||||||
|
"content" : global_tun_buf }
|
||||||
|
|
||||||
|
body_tpl.execute(global_tun_fh, body_args)
|
||||||
|
global_tun_fh.close()
|
||||||
|
|
||||||
|
|
||||||
|
#build the global boolean index
|
||||||
|
global_bool_buf = []
|
||||||
|
for boolean in doc.getElementsByTagName("boolean"):
|
||||||
|
if boolean.parentNode.nodeName == "policy":
|
||||||
|
bool_name = boolean.getAttribute("name")
|
||||||
|
default_value = boolean.getAttribute("dftval")
|
||||||
|
global_bool_buf.append( { "bool_name" : bool_name,
|
||||||
|
"def_val" : default_value } )
|
||||||
|
global_bool_buf.sort(bool_cmp)
|
||||||
|
global_bool_tpl = pyplate.Template(boollistdata)
|
||||||
|
global_bool_buf = global_bool_tpl.execute_string({"booleans" : global_bool_buf})
|
||||||
|
global_bool_file = "global_booleans.html"
|
||||||
|
global_bool_fh = open(global_bool_file, "w")
|
||||||
|
body_tpl = pyplate.Template(bodydata)
|
||||||
|
|
||||||
|
body_args = { "menu" : menu_buf,
|
||||||
|
"content" : global_bool_buf }
|
||||||
|
|
||||||
|
body_tpl.execute(global_bool_fh, body_args)
|
||||||
|
global_bool_fh.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def error(error):
|
def error(error):
|
||||||
"""
|
"""
|
||||||
Print an error message and exit.
|
Print an error message and exit.
|
||||||
|
Loading…
Reference in New Issue
Block a user