def main(): Script.addDefaultOptionValue("/DIRAC/Security/SkipCAChecks", "yes") Script.parseCommandLine(ignoreErrors=True) bdc = BundleDeliveryClient() result = bdc.syncCAs() if not result["OK"]: DIRAC.gLogger.error("Error while updating CAs", result["Message"]) DIRAC.exit(1) elif result["Value"]: DIRAC.gLogger.notice("CAs got updated") else: DIRAC.gLogger.notice("CAs are already synchronized") result = bdc.syncCRLs() if not result["OK"]: DIRAC.gLogger.error("Error while updating CRLs", result["Message"]) DIRAC.exit(1) elif result["Value"]: DIRAC.gLogger.notice("CRLs got updated") else: DIRAC.gLogger.notice("CRLs are already synchronized") DIRAC.exit(0)
def main(): params = Params() Script.registerSwitch("f:", "file=", "File to use as proxy", params.setProxyLocation) Script.registerSwitch("D", "DN", "Use DN as myproxy username", params.setDNAsUsername) Script.addDefaultOptionValue("LogLevel", "always") Script.parseCommandLine() from DIRAC.Core.Security.MyProxy import MyProxy from DIRAC.Core.Security import Locations if not params.proxyLoc: params.proxyLoc = Locations.getProxyLocation() if not params.proxyLoc: print("Can't find any valid proxy") sys.exit(1) print("Uploading proxy file %s" % params.proxyLoc) mp = MyProxy() retVal = mp.uploadProxy(params.proxyLoc, params.dnAsUsername) if not retVal["OK"]: print("Can't upload proxy:") print(" ", retVal["Message"]) sys.exit(1) print("Proxy uploaded") sys.exit(0)
def registerCLISwitches(self): Script.registerSwitch( "v:", "valid=", "Valid HH:MM for the proxy. By default is one month", self.setProxyLifeTime) Script.registerSwitch("C:", "Cert=", "File to use as user certificate", self.setCertLocation) Script.registerSwitch("K:", "Key=", "File to use as user key", self.setKeyLocation) Script.registerSwitch("P:", "Proxy=", "File to use as proxy", self.setProxyLocation) Script.registerSwitch("f", "onthefly", "Generate a proxy on the fly", self.setOnTheFly) Script.registerSwitch("p", "pwstdin", "Get passwd from stdin", self.setStdinPasswd) Script.addDefaultOptionValue("LogLevel", "always")
def main(): cliParams = Params() Script.disableCS() Script.registerSwitch( "e", "exitOnError", "flag to exit on error of any component installation", cliParams.setExitOnError) Script.addDefaultOptionValue("/DIRAC/Security/UseServerCertificate", "yes") Script.addDefaultOptionValue("LogLevel", "INFO") Script.parseCommandLine() args = Script.getExtraCLICFGFiles() if len(args) > 1: Script.showHelp(exitCode=1) cfg = None if len(args): cfg = args[0] from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller gComponentInstaller.exitOnError = cliParams.exitOnError result = gComponentInstaller.setupSite(Script.localCfg, cfg) if not result["OK"]: print("ERROR:", result["Message"]) exit(-1) result = gComponentInstaller.getStartupComponentStatus([]) if not result["OK"]: print("ERROR:", result["Message"]) exit(-1) print("\nStatus of installed components:\n") result = gComponentInstaller.printStartupStatus(result["Value"]) if not result["OK"]: print("ERROR:", result["Message"]) exit(-1)