View | Details | Raw Unified | Return to bug 22517
Collapse All | Expand All

(-)python/univention/config_registry.py (-8 / +9 lines)
Lines 379-395 Link Here
379
	return template
405
	return template
380
406
381
def runScript(script, arg, changes):
407
def runScript(script, arg, changes):
382
408
	"""
383
	s = ''
409
	Execute script with command line arguments using a shell and pass changes on STDIN.
410
	For each changed variable a line with the 'name of the variable', the 'old value', and the 'new value' are passed seperated by '@%@'.
411
	"""
412
	diff = []
384
	for key, value in changes.items():
413
	for key, value in changes.items():
385
		if value and len(value) > 1 and value[0] and value[1]:
414
		if value and len(value) > 1 and value[0] and value[1]:
386
			s += '%s@%%@%s@%%@%s\n' % (key, value[0], value[1])
415
			diff.append('%s@%%@%s@%%@%s\n' % (key, value[0], value[1]))
387
416
388
	p = subprocess.Popen(script+" "+arg, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
417
	with open(os.path.devnull, 'w') as null:
389
	p_out, p_in = p.stdin, p.stdout
418
		p = subprocess.Popen(script + " " + arg, shell=True, stdin=subprocess.PIPE, stdout=null, close_fds=True)
390
	p_out.write(s)
419
		p.communicate(''.join(diff))
391
	p_out.close()
392
	p_in.close()
393
420
394
def runModule(modpath, arg, ucr, changes):
421
def runModule(modpath, arg, ucr, changes):
395
	arg2meth = { 'generate': lambda obj: getattr(obj, 'handler'),
422
	arg2meth = { 'generate': lambda obj: getattr(obj, 'handler'),

Return to bug 22517