+ def email_validator(val):
+ return re.match('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z', val)
+
+ def boolean_validator (val):
+ return val in ['true', 'false']
+
- 'email' : lambda val: re.match('[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-_]+\.[a-zA-Z]+', val),
- 'ip': ip_validator
+ 'email' : email_validator,
+ 'ip': ip_validator,
+ 'boolean': boolean_validator,
mainloop_usage= """Available commands:
Uppercase versions give variables comments, when available
u/U\t\t\tEdit usual variables
mainloop_usage= """Available commands:
Uppercase versions give variables comments, when available
u/U\t\t\tEdit usual variables
- w/W\t\t\tWrite / Write & reload
- r\t\t\tRestart %s service
+ w\t\t\tWrite
+ r\t\t\tRestart %(service)s service
+ R\t\t\tReload %(service)s service (rebuild config files for sh, python....)
---
Typical usage involves: u, [l,] w, r, q
---
Typical usage involves: u, [l,] w, r, q
try:
# Confirm that various constraints are met before saving file.
validate_variables = g_configuration.get('validate_variables',{})
try:
# Confirm that various constraints are met before saving file.
validate_variables = g_configuration.get('validate_variables',{})
consolidate(default_config, site_config, consolidated_config)
print ("You might want to type 'r' (restart %s), 'R' (reload %s) or 'q' (quit)" % \
(service,service))
consolidate(default_config, site_config, consolidated_config)
print ("You might want to type 'r' (restart %s), 'R' (reload %s) or 'q' (quit)" % \
(service,service))
if mode == 'ALL':
prompt_variables_all(cdef, cread, cwrite,show_comments)
elif mode == 'CATEGORY':
if mode == 'ALL':
prompt_variables_all(cdef, cread, cwrite,show_comments)
elif mode == 'CATEGORY':
prompt_variable (cdef,cread,cwrite,category,variable,
show_comments,False)
except Exception, inst:
prompt_variable (cdef,cread,cwrite,category,variable,
show_comments,False)
except Exception, inst:
show_value=(command in "sSlL")
(c1,c2,c3) = (cdef, cread, cwrite)
show_value=(command in "sSlL")
(c1,c2,c3) = (cdef, cread, cwrite)
(c1,c2,c3) = (cwrite,cwrite,cwrite)
if mode == 'ALL':
show_variables_all(c1,c2,c3,show_value,show_comments)
(c1,c2,c3) = (cwrite,cwrite,cwrite)
if mode == 'ALL':
show_variables_all(c1,c2,c3,show_value,show_comments)