Index: univention-directory-policy/univention-policy-update-config-registry.py =================================================================== --- univention-directory-policy/univention-policy-update-config-registry.py (Revision 51240) +++ univention-directory-policy/univention-policy-update-config-registry.py (Arbeitskopie) @@ -35,17 +35,19 @@ import univention.config_registry as confreg from optparse import OptionParser -def get_policy(host_dn, verbose=False): +def get_policy(host_dn, verbose=False, server=None): """Retriev policy for host_dn.""" set_list = {} # get policy result if verbose: print >> sys.stderr, 'Retrieving policy for %s...' % (host_dn,) - cmd = ('univention_policy_result', - '-D', host_dn, - '-y', '/etc/machine.secret', - host_dn) + cmd = ['univention_policy_result'] + cmd += ['-D', host_dn] + cmd += ['-y', '/etc/machine.secret'] + if server: + cmd += ['-h', server] + cmd += [host_dn] proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE) for line in proc.stdout: line = line.rstrip('\n') @@ -81,6 +83,7 @@ parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='print verbose information') + parser.add_option('-l', '--ldap-server', dest='server', help='connect to this ldap host') options, args = parser.parse_args() if 'UNIVENTION_BASECONF' in os.environ: @@ -110,7 +113,7 @@ ucr_ldap = confreg.ConfigRegistry(filename=confregfn) ucr_ldap.load() - set_list = get_policy(host_dn, options.verbose) + set_list = get_policy(host_dn, options.verbose, options.server) if set_list: new_set_list = [] for key, value in set_list.items():