From 6b8a20c945a437091409c64131f3b1ea00353cdb Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Mon, 18 Nov 2024 17:22:00 +0100 Subject: [PATCH] feat: Load LDAP domain from config.json instead of command line argument --- imageroot/bin/setup-ldap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imageroot/bin/setup-ldap b/imageroot/bin/setup-ldap index 7b3a1b3..9d6722a 100755 --- a/imageroot/bin/setup-ldap +++ b/imageroot/bin/setup-ldap @@ -30,6 +30,7 @@ import sys import agent import subprocess from agent.ldapproxy import Ldapproxy +import json # Execute occ command # It returns the process exit code and output @@ -41,11 +42,10 @@ def occ(args): def set_ldap(k, v): return occ(["ldap:set-config", "s01", k, v]) -if len(sys.argv) < 2: - print("setup-ldap: no argument given", file=sys.stderr) - sys.exit(1) +with open('config.json', 'r') as cf: + config = json.loads(cf.read()) +cdomain = config.get("domain") -cdomain = sys.argv[1] commands = [] if not cdomain: