|
42 |
import grp |
42 |
import grp |
43 |
import time |
43 |
import time |
44 |
from debhelper import parseRfc822 |
44 |
from debhelper import parseRfc822 |
45 |
try: |
45 |
from pipes import quote as escape_value |
46 |
from univention.lib.shell import escape_value |
|
|
47 |
except ImportError: |
48 |
def escape_value(v): sys.exit(1) # FIXME: univention.lib clashed during install |
49 |
|
46 |
|
50 |
variable_pattern = re.compile('@%@([^@]+)@%@') |
47 |
variable_pattern = re.compile('@%@([^@]+)@%@') |
51 |
variable_token = re.compile('@%@') |
48 |
variable_token = re.compile('@%@') |
|
1052 |
|
1049 |
|
1053 |
def replog(method, scope, ucr, var, value=None): |
1050 |
def replog(method, scope, ucr, var, value=None): |
1054 |
""" |
1051 |
""" |
1055 |
This function writes a new entry to replication logfile if |
1052 |
This function writes a new entry to replication logfile if |
1056 |
this feature has been enabled. |
1053 |
this feature has been enabled. |
1057 |
""" |
1054 |
""" |
1058 |
if ucr.is_true('ucr/replog/enabled',False): |
1055 |
if ucr.is_true('ucr/replog/enabled',False): |
1059 |
if method == 'set': |
1056 |
if method == 'set': |
Lines 1091-1104
def handler_set( args, opts = {}, quiet = False ):
|
Link Here
|
---|
|
1091 |
current_scope = ConfigRegistry.NORMAL |
1088 |
current_scope = ConfigRegistry.NORMAL |
1092 |
reg = None |
1089 |
reg = None |
1093 |
if opts.get( 'ldap-policy', False ): |
1090 |
if opts.get( 'ldap-policy', False ): |
1094 |
current_scope = ConfigRegistry.LDAP |
1091 |
current_scope = ConfigRegistry.LDAP |
1095 |
reg = ConfigRegistry( write_registry = current_scope ) |
1092 |
reg = ConfigRegistry( write_registry = current_scope ) |
1096 |
elif opts.get( 'force', False ): |
1093 |
elif opts.get( 'force', False ): |
1097 |
current_scope = ConfigRegistry.FORCED |
1094 |
current_scope = ConfigRegistry.FORCED |
1098 |
reg = ConfigRegistry( write_registry = current_scope) |
1095 |
reg = ConfigRegistry( write_registry = current_scope) |
1099 |
elif opts.get( 'schedule', False ): |
1096 |
elif opts.get( 'schedule', False ): |
1100 |
current_scope = ConfigRegistry.SCHEDULE |
1097 |
current_scope = ConfigRegistry.SCHEDULE |
1101 |
reg = ConfigRegistry( write_registry = current_scope) |
1098 |
reg = ConfigRegistry( write_registry = current_scope) |
1102 |
else: |
1099 |
else: |
1103 |
reg = ConfigRegistry() |
1100 |
reg = ConfigRegistry() |
1104 |
|
1101 |
|
Lines 1152-1168
def handler_unset( args, opts = {} ):
|
Link Here
|
---|
|
1152 |
""" |
1149 |
""" |
1153 |
Unset config registry variables in args. |
1150 |
Unset config registry variables in args. |
1154 |
""" |
1151 |
""" |
1155 |
current_scope = ConfigRegistry.NORMAL |
1152 |
current_scope = ConfigRegistry.NORMAL |
1156 |
reg = None |
1153 |
reg = None |
1157 |
if opts.get( 'ldap-policy', False ): |
1154 |
if opts.get( 'ldap-policy', False ): |
1158 |
current_scope = ConfigRegistry.LDAP |
1155 |
current_scope = ConfigRegistry.LDAP |
1159 |
reg = ConfigRegistry( write_registry = current_scope ) |
1156 |
reg = ConfigRegistry( write_registry = current_scope ) |
1160 |
elif opts.get( 'force', False ): |
1157 |
elif opts.get( 'force', False ): |
1161 |
current_scope = ConfigRegistry.FORCED |
1158 |
current_scope = ConfigRegistry.FORCED |
1162 |
reg = ConfigRegistry( write_registry = current_scope) |
1159 |
reg = ConfigRegistry( write_registry = current_scope) |
1163 |
elif opts.get( 'schedule', False ): |
1160 |
elif opts.get( 'schedule', False ): |
1164 |
current_scope = ConfigRegistry.SCHEDULE |
1161 |
current_scope = ConfigRegistry.SCHEDULE |
1165 |
reg = ConfigRegistry( write_registry = current_scope) |
1162 |
reg = ConfigRegistry( write_registry = current_scope) |
1166 |
else: |
1163 |
else: |
1167 |
reg = ConfigRegistry() |
1164 |
reg = ConfigRegistry() |
1168 |
reg.lock() |
1165 |
reg.lock() |
Lines 1329-1352
def handler_search( args, opts = {} ):
|
Link Here
|
---|
|
1329 |
all_vars = {} |
1326 |
all_vars = {} |
1330 |
for key, var in info.get_variables (category).items (): |
1327 |
for key, var in info.get_variables (category).items (): |
1331 |
all_vars [ key ] = ( None, var, None ) |
1328 |
all_vars [ key ] = ( None, var, None ) |
1332 |
for key, scope_value in b.items( getscope = True ): |
1329 |
for key, scope_value in b.items( getscope = True ): |
1333 |
var_triple = all_vars.get ( key ) |
1330 |
var_triple = all_vars.get ( key ) |
1334 |
if var_triple: |
1331 |
if var_triple: |
1335 |
all_vars [ key ] = ( scope_value[1], var_triple[1], scope_value[0] ) |
1332 |
all_vars [ key ] = ( scope_value[1], var_triple[1], scope_value[0] ) |
1336 |
elif not category: |
1333 |
elif not category: |
1337 |
all_vars [ key ] = ( scope_value[1], None, scope_value[0] ) |
1334 |
all_vars [ key ] = ( scope_value[1], None, scope_value[0] ) |
1338 |
|
1335 |
|
1339 |
for key, var_triple in all_vars.items(): |
1336 |
for key, var_triple in all_vars.items(): |
1340 |
for reg in regex: |
1337 |
for reg in regex: |
1341 |
if \ |
1338 |
if \ |
1342 |
( search_keys and reg.search ( key ) ) or \ |
1339 |
( search_keys and reg.search ( key ) ) or \ |
1343 |
( search_values and var_triple[0] and reg.search ( var_triple[0] ) ) or \ |
1340 |
( search_values and var_triple[0] and reg.search ( var_triple[0] ) ) or \ |
1344 |
( search_all and ( \ |
1341 |
( search_all and ( \ |
1345 |
( reg.search ( key ) ) or \ |
1342 |
( reg.search ( key ) ) or \ |
1346 |
( var_triple[0] and reg.search ( var_triple[0] ) ) or \ |
1343 |
( var_triple[0] and reg.search ( var_triple[0] ) ) or \ |
1347 |
( var_triple[1] and reg.search ( var_triple[1].get ( 'description', '' ) ) ) ) \ |
1344 |
( var_triple[1] and reg.search ( var_triple[1].get ( 'description', '' ) ) ) ) \ |
1348 |
): |
1345 |
): |
1349 |
print_variable_info_string ( key, var_triple[0], var_triple[1], var_triple[2], show_scope, brief, non_empty, verbose ) |
1346 |
print_variable_info_string ( key, var_triple[0], var_triple[1], var_triple[2], show_scope, brief, non_empty, verbose ) |
1350 |
break |
1347 |
break |
1351 |
|
1348 |
|
1352 |
def handler_get( args, opts = {} ): |
1349 |
def handler_get( args, opts = {} ): |