def main():
    PARAMS = Params()
    PARAMS.registerSwitches()
    Script.parseCommandLine(ignoreErrors=False)

    # Create Data Recovery Agent and run over single transformation.
    from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
    from DIRAC.TransformationSystem.Agent.DataRecoveryAgent import DataRecoveryAgent

    DRA = DataRecoveryAgent("Transformation/DataRecoveryAgent",
                            "Transformation/DataRecoveryAgent")
    DRA.jobStatus = ["Done", "Failed"]
    DRA.enabled = PARAMS.enabled
    TRANSFORMATION = TransformationClient().getTransformations(
        condDict={"TransformationID": PARAMS.transID})
    if not TRANSFORMATION["OK"]:
        gLogger.error("Failed to find transformation: %s" %
                      TRANSFORMATION["Message"])
        exit(1)
    if not TRANSFORMATION["Value"]:
        gLogger.error("Did not find any transformations")
        exit(1)
    TRANS_INFO_DICT = TRANSFORMATION["Value"][0]
    TRANS_INFO_DICT.pop("Body", None)
    gLogger.notice("Found transformation: %s" % TRANS_INFO_DICT)
    DRA.treatTransformation(PARAMS.transID, TRANS_INFO_DICT)
    exit(0)
Пример #2
0
def main():
    Script.disableCS()
    params = Params()
    if len(sys.argv) < 2:
        runConfigurationWizard(params)
    else:
        return runDiracConfigure(params)
Пример #3
0
def main():
    Script.registerSwitch("D:", "Dir=", "Store the output in this directory")
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["JobID:    DIRAC Job ID"])
    sws, args = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC.Interfaces.API.Dirac import Dirac, parseArguments

    dirac = Dirac()
    exitCode = 0
    errorList = []

    outputDir = ""
    for sw, v in sws:
        if sw in ("D", "Dir"):
            outputDir = v

    for job in parseArguments(args):

        result = dirac.getJobOutputData(job, destinationDir=outputDir)
        if result["OK"]:
            print("Job %s output data retrieved" % (job))
        else:
            errorList.append((job, result["Message"]))
            exitCode = 2

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRAC.exit(exitCode)
Пример #4
0
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)
Пример #5
0
def parseSwitches():
    """
    Parses the arguments passed by the user
    """

    Script.parseCommandLine(ignoreErrors=True)
    args = Script.getPositionalArgs()
    if args:
        subLogger.error("Found the following positional args '%s', but we only accept switches" % args)
        subLogger.error("Please, check documentation below")
        Script.showHelp(exitCode=1)

    switches = dict(Script.getUnprocessedSwitches())
    # Default values
    switches.setdefault("elementType", None)
    switches.setdefault("name", None)
    switches.setdefault("tokenOwner", None)
    switches.setdefault("statusType", None)
    switches.setdefault("status", None)
    switches.setdefault("VO", None)

    if "element" not in switches:
        subLogger.error("element Switch missing")
        subLogger.error("Please, check documentation below")
        Script.showHelp(exitCode=1)

    if not switches["element"] in ("Site", "Resource", "Node"):
        subLogger.error("Found %s as element switch" % switches["element"])
        subLogger.error("Please, check documentation below")
        Script.showHelp(exitCode=1)

    subLogger.debug("The switches used are:")
    map(subLogger.debug, switches.items())

    return switches
    def registerSwitchesAndParseCommandLine(self):
        """Register the default plus additional parameters and parse options.

        :param list options: list of three tuple for options to add to the script
        :param list flags:  list of three tuple for flags to add to the script
        :param str opName
        """
        for short, longOption, doc in self.options:
            Script.registerSwitch(short + ":" if short else "",
                                  longOption + "=", doc)
        for short, longOption, doc in self.flags:
            Script.registerSwitch(short, longOption, doc)
            self.switches[longOption] = False
        Script.parseCommandLine()
        if Script.getPositionalArgs():
            Script.showHelp(exitCode=1)

        for switch in Script.getUnprocessedSwitches():
            for short, longOption, doc in self.options:
                if switch[0] == short or switch[0].lower() == longOption.lower(
                ):
                    sLog.verbose("Found switch %r with value %r" %
                                 (longOption, switch[1]))
                    self.switches[longOption] = switch[1]
                    break
            for short, longOption, doc in self.flags:
                if switch[0] == short or switch[0].lower() == longOption.lower(
                ):
                    self.switches[longOption] = True
                    break

        self.checkSwitches()
        self.switches["DryRun"] = not self.switches.get("Execute", False)
        self.switches["SourceSE"] = self.switches.get("SourceSE",
                                                      "").split(",")
Пример #7
0
 def getBoolean(value):
     if value.lower() == "true":
         return True
     elif value.lower() == "false":
         return False
     else:
         Script.showHelp()
Пример #8
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["PilotID:  Grid ID of the pilot"])
    # parseCommandLine show help when mandatory arguments are not specified or incorrect argument
    _, args = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import exit as DIRACExit
    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin

    diracAdmin = DiracAdmin()
    exitCode = 0
    errorList = []

    for gridID in args:

        result = diracAdmin.getPilotLoggingInfo(gridID)
        if not result["OK"]:
            errorList.append((gridID, result["Message"]))
            exitCode = 2
        else:
            print("Pilot Reference: %s", gridID)
            print(result["Value"])
            print()

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRACExit(exitCode)
Пример #9
0
def parseSwitchesAndPositionalArguments():
    """
    Parse switches and positional arguments given to the script
    """

    # Parse the command line and initialize DIRAC
    Script.parseCommandLine(ignoreErrors=False)

    # Get arguments
    allArgs = Script.getPositionalArgs()
    gLogger.debug("All arguments: %s" % ", ".join(allArgs))

    # Get unprocessed switches
    switches = dict(Script.getUnprocessedSwitches())

    gLogger.debug("The switches used are:")
    map(gLogger.debug, switches.iteritems())

    # Get grouped positional arguments
    repType, user, services = Script.getPositionalArgs(group=True)
    gLogger.debug("The positional arguments are:")
    gLogger.debug("Report type:", repType)
    gLogger.debug("Name or DN:", user)
    gLogger.debug("Services:", services)

    return switches, repType, user, services
Пример #10
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(
        ["LFN:      Logical File Name or file containing LFNs"])
    _, lfns = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC.Interfaces.API.Dirac import Dirac

    dirac = Dirac()
    exitCode = 0
    errorList = []

    if len(lfns) == 1:
        try:
            with open(lfns[0], "r") as f:
                lfns = f.read().splitlines()
        except Exception:
            pass

    result = dirac.getLfnMetadata(lfns, printOutput=True)
    if not result["OK"]:
        print("ERROR: ", result["Message"])
        exitCode = 2

    DIRAC.exit(exitCode)
def main():
    """reads command line parameters, makes check and creates replication transformation"""
    from DIRAC import gLogger, exit as dexit
    from DIRAC.TransformationSystem.Utilities.ReplicationCLIParameters import Params

    clip = Params()
    clip.registerSwitches(Script)
    Script.parseCommandLine()

    from DIRAC.TransformationSystem.Utilities.ReplicationTransformation import createDataTransformation

    if not clip.checkSettings(Script)["OK"]:
        gLogger.error("ERROR: Missing settings")
        dexit(1)
    for metaValue in clip.metaValues:
        resCreate = createDataTransformation(
            flavour=clip.flavour,
            targetSE=clip.targetSE,
            sourceSE=clip.sourceSE,
            metaKey=clip.metaKey,
            metaValue=metaValue,
            extraData=clip.extraData,
            extraname=clip.extraname,
            groupSize=clip.groupSize,
            tGroup=clip.groupName,
            plugin=clip.plugin,
            enable=clip.enable,
        )
        if not resCreate["OK"]:
            gLogger.error("Failed to create Transformation",
                          resCreate["Message"])
            dexit(1)

    dexit(0)
Пример #12
0
def main():
    Script.registerSwitch("a", "All", "  Also show inactive replicas")
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(
        ["LFN:      Logical File Name or file containing LFNs"])
    switches, lfns = Script.parseCommandLine(ignoreErrors=True)

    active = True
    for switch in switches:
        opt = switch[0].lower()
        if opt in ("a", "all"):
            active = False

    from DIRAC.Interfaces.API.Dirac import Dirac

    dirac = Dirac()
    exitCode = 0

    if len(lfns) == 1:
        try:
            with open(lfns[0], "r") as f:
                lfns = f.read().splitlines()
        except Exception:
            pass

    result = dirac.getReplicas(lfns, active=active, printOutput=True)
    if not result["OK"]:
        print("ERROR: ", result["Message"])
        exitCode = 2

    DIRAC.exit(exitCode)
Пример #13
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["User:     User name"])
    # parseCommandLine show help when mandatory arguments are not specified or incorrect argument
    _, args = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import exit as DIRACExit
    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin

    diracAdmin = DiracAdmin()
    exitCode = 0
    errorList = []

    choice = input("Are you sure you want to delete user/s %s? yes/no [no]: " %
                   ", ".join(args))
    choice = choice.lower()
    if choice not in ("yes", "y"):
        print("Delete aborted")
        DIRACExit(0)

    for user in args:
        if not diracAdmin.csDeleteUser(user):
            errorList.append(("delete user", "Cannot delete user %s" % user))
            exitCode = 255

    if not exitCode:
        result = diracAdmin.csCommitChanges()
        if not result["OK"]:
            errorList.append(("commit", result["Message"]))
            exitCode = 255

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRACExit(exitCode)
Пример #14
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["JobID:    DIRAC Job IDs"])
    _, args = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin

    diracAdmin = DiracAdmin()
    exitCode = 0
    errorList = []

    for job in args:

        try:
            job = int(job)
        except Exception as x:
            errorList.append(("Expected integer for jobID", job))
            exitCode = 2
            continue

        result = diracAdmin.resetJob(job)
        if result["OK"]:
            print("Reset Job %s" % (job))
        else:
            errorList.append((job, result["Message"]))
            exitCode = 2

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRAC.exit(exitCode)
Пример #15
0
def main():
    params = Params()
    params.registerCLISwitches()
    Script.parseCommandLine(ignoreErrors=True)
    result = gProxyManager.getDBContents()
    if not result["OK"]:
        print("Can't retrieve list of users: %s" % result["Message"])
        DIRAC.exit(1)

    keys = result["Value"]["ParameterNames"]
    records = result["Value"]["Records"]
    dataDict = {}
    now = datetime.datetime.utcnow()
    for record in records:
        expirationDate = record[3]
        dt = expirationDate - now
        secsLeft = dt.days * 86400 + dt.seconds
        if secsLeft > params.proxyLifeTime:
            userName, userDN, userGroup, _, persistent = record
            if userName not in dataDict:
                dataDict[userName] = []
            dataDict[userName].append((userDN, userGroup, expirationDate, persistent))

    for userName in dataDict:
        print("* %s" % userName)
        for iP in range(len(dataDict[userName])):
            data = dataDict[userName][iP]
            print(" DN         : %s" % data[0])
            print(" group      : %s" % data[1])
            print(" not after  : %s" % TimeUtilities.toString(data[2]))
            print(" persistent : %s" % data[3])
            if iP < len(dataDict[userName]) - 1:
                print(" -")

    DIRAC.exit(0)
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["JobID:    DIRAC ID of the Job"])
    # parseCommandLine show help when mandatory arguments are not specified or incorrect argument
    _, args = Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import exit as DIRACExit
    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin

    diracAdmin = DiracAdmin()
    exitCode = 0
    errorList = []

    for job in args:

        try:
            job = int(job)
        except Exception:
            errorList.append(("Expected integer for JobID", job))
            exitCode = 2
            continue

        result = diracAdmin.getJobPilotOutput(job)
        if not result["OK"]:
            errorList.append((job, result["Message"]))
            exitCode = 2

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRACExit(exitCode)
Пример #17
0
def main():
    Script.parseCommandLine()

    from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient

    prodClient = ProductionClient()
    res = prodClient.getProductions()

    fields = ["ProductionName", "Status", "ProductionID", "CreationDate", "LastUpdate", "AuthorDN", "AuthorGroup"]
    records = []

    if res["OK"]:
        prodList = res["Value"]
        if not isinstance(res["Value"], list):
            prodList = [res["Value"]]
        for prod in prodList:
            records.append(
                [
                    str(prod["ProductionName"]),
                    str(prod["Status"]),
                    str(prod["ProductionID"]),
                    str(prod["CreationDate"]),
                    str(prod["LastUpdate"]),
                    str(prod["AuthorDN"]),
                    str(prod["AuthorGroup"]),
                ]
            )
    else:
        DIRAC.gLogger.error(res["Message"])
        DIRAC.exit(-1)

    printTable(fields, records)

    DIRAC.exit(0)
Пример #18
0
def main():
    Script.disableCS()
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(
        " System:  Name of the system for the component (default *: all)",
        mandatory=False,
        default="*")
    Script.registerArgument(
        (
            "Service: Name of the particular component (default *: all)",
            "Agent:   Name of the particular component (default *: all)",
        ),
        mandatory=False,
        default="*",
    )
    _, args = Script.parseCommandLine()
    system, component = Script.getPositionalArgs(group=True)

    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

    if len(args) > 2:
        Script.showHelp(exitCode=1)

    if system != "*":
        if len(args) > 1:
            component = args[1]

    gComponentInstaller.exitOnError = True

    result = gComponentInstaller.runsvctrlComponent(system, component, "d")
    if not result["OK"]:
        print("ERROR:", result["Message"])
        exit(-1)

    gComponentInstaller.printStartupStatus(result["Value"])
Пример #19
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(["User: list of SEs or comma-separated SEs"],
                            mandatory=False)

    _, users = Script.parseCommandLine()

    from DIRAC import gLogger, gConfig

    if not users:
        res = gConfig.getSections("/Registry/Users")
        if not res["OK"]:
            gLogger.error("Failed to retrieve user list from CS",
                          res["Message"])
            DIRAC.exit(2)
        users = res["Value"]

    gLogger.notice("-" * 30)
    gLogger.notice("%s|%s" % ("Username".ljust(15), "Quota (GB)".rjust(15)))
    gLogger.notice("-" * 30)
    for user in sorted(users):
        quota = gConfig.getValue("/Registry/Users/%s/Quota" % user, 0)
        if not quota:
            quota = gConfig.getValue("/Registry/DefaultStorageQuota")
        gLogger.notice("%s|%s" % (user.ljust(15), str(quota).rjust(15)))
    gLogger.notice("-" * 30)
    DIRAC.exit(0)
Пример #20
0
def main():
    Script.registerArgument(["Agent: specify which agent to run"])
    positionalArgs = Script.getPositionalArgs(group=True)
    localCfg = Script.localCfg

    agentName = positionalArgs[0]
    localCfg.setConfigurationForAgent(agentName)
    localCfg.addMandatoryEntry("/DIRAC/Setup")
    localCfg.addDefaultEntry("/DIRAC/Security/UseServerCertificate", "yes")
    localCfg.addDefaultEntry("LogLevel", "INFO")
    localCfg.addDefaultEntry("LogColor", True)
    resultDict = localCfg.loadUserData()
    if not resultDict["OK"]:
        gLogger.error("There were errors when loading configuration", resultDict["Message"])
        sys.exit(1)

    includeExtensionErrors()

    agentReactor = AgentReactor(positionalArgs[0])
    result = agentReactor.loadAgentModules(positionalArgs)
    if result["OK"]:
        agentReactor.go()
    else:
        gLogger.error("Error while loading agent module", result["Message"])
        sys.exit(2)
Пример #21
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument("PFN:      Physical File Name or file containing PFNs")
    Script.registerArgument("SE:       Valid DIRAC SE")
    _, args = Script.parseCommandLine(ignoreErrors=True)

    if len(args) > 2:
        print("Only one PFN SE pair will be considered")

    from DIRAC.Interfaces.API.Dirac import Dirac

    dirac = Dirac()
    exitCode = 0

    pfn = args[0]
    seName = args[1]
    try:
        with open(pfn, "r") as f:
            pfns = f.read().splitlines()
    except Exception:
        pfns = [pfn]

    for pfn in pfns:
        result = dirac.getPhysicalFileAccessURL(pfn, seName, printOutput=True)
        if not result["OK"]:
            print("ERROR: ", result["Message"])
            exitCode = 2

    DIRAC.exit(exitCode)
Пример #22
0
def main():
    Script.registerSwitch("e", "extended", "Show extended info")

    Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import exit as DIRACExit
    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin

    diracAdmin = DiracAdmin()
    exitCode = 0
    errorList = []
    extendedInfo = False

    for unprocSw in Script.getUnprocessedSwitches():
        if unprocSw[0] in ("e", "extended"):
            extendedInfo = True

    if not extendedInfo:
        result = diracAdmin.csListHosts()
        for host in result["Value"]:
            print(" %s" % host)
    else:
        result = diracAdmin.csDescribeHosts()
        print(diracAdmin.pPrint.pformat(result["Value"]))

    for error in errorList:
        print("ERROR %s: %s" % error)

    DIRACExit(exitCode)
Пример #23
0
def main():
    Script.parseCommandLine(ignoreErrors=True)

    result = Utilities.generateRevokedCertsFile()
    if not result["OK"]:
        gLogger.error(result["Message"])
        sys.exit(1)
Пример #24
0
def main():
    Script.registerSwitch("", "Full", "   Print full list of requests")
    Script.parseCommandLine()
    from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient

    fullPrint = False

    for switch in Script.getUnprocessedSwitches():
        if switch[0] == "Full":
            fullPrint = True

    reqClient = ReqClient()

    for server, rpcClient in reqClient.requestProxies().items():
        DIRAC.gLogger.always("Checking request cache at %s" % server)
        reqCache = rpcClient.listCacheDir()
        if not reqCache["OK"]:
            DIRAC.gLogger.error("Cannot list request cache", reqCache)
            continue
        reqCache = reqCache["Value"]

        if not reqCache:
            DIRAC.gLogger.always("No request in cache")
        else:
            if fullPrint:
                DIRAC.gLogger.always("List of requests", reqCache)
            else:
                DIRAC.gLogger.always("Number of requests in the cache",
                                     len(reqCache))

    DIRAC.exit(0)
Пример #25
0
def registerSwitches():
    """
    Registers all switches that can be used while calling the script from the
    command line interface.
    """

    switches = (
        ("element=",
         "Element family to be Synchronized ( Site, Resource, Node )"),
        ("tableType=", "A valid table type (Status, Log, History)"),
        ("name=",
         "ElementName (comma separated list allowed); None if default"),
        (
            "statusType=",
            "A valid StatusType argument (it admits a comma-separated list of statusTypes); None if default",
        ),
        ("status=",
         "A valid Status argument ( Active, Probing, Degraded, Banned, Unknown, Error ); None if default"
         ),
        ("elementType=", "ElementType narrows the search; None if default"),
        ("reason=", "Decision that triggered the assigned status"),
        ("lastCheckTime=",
         "Time-stamp setting last time the status & status were checked"),
        ("tokenOwner=",
         "Owner of the token ( to specify only with select/delete queries"),
        ("VO=", "Virtual organisation; None if default"),
    )

    for switch in switches:
        Script.registerSwitch("", switch[0], switch[1])
Пример #26
0
def registerUsageMessage():
    """
    Takes the script __doc__ and adds the DIRAC version to it
    """
    usageMessage = "DIRAC %s\n" % version
    usageMessage += __doc__

    Script.setUsageMessage(usageMessage)
Пример #27
0
def main():
    Script.disableCS()
    Script.parseCommandLine()

    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

    gComponentInstaller.exitOnError = True
    gComponentInstaller.setupPortal()
Пример #28
0
def setUserMail(arg):
    global userMail
    if userMail or not arg:
        Script.showHelp(exitCode=1)
    if not arg.find("@") > 0:
        gLogger.error("Not a valid mail address", arg)
        DIRAC.exit(-1)
    userMail = arg
Пример #29
0
def main():
    Script.localCfg.addDefaultEntry("LogLevel", "info")
    Script.parseCommandLine()

    from DIRAC.AccountingSystem.Client.AccountingCLI import AccountingCLI

    acli = AccountingCLI()
    acli.start()
Пример #30
0
    def registerSwitchesAndParseCommandLine(self):
        """Register the default plus additional parameters and parse options.

        :param list options: list of three tuple for options to add to the script
        :param list flags:  list of three tuple for flags to add to the script
        :param str opName
        """
        for short, longOption, doc in self.options:
            Script.registerSwitch(short + ":" if short else "",
                                  longOption + "=", doc)
        for short, longOption, doc in self.flags:
            Script.registerSwitch(short, longOption, doc)
            self.switches[longOption] = False
        Script.parseCommandLine()
        if Script.getPositionalArgs():
            Script.showHelp(exitCode=1)

        ops = Operations()
        if not ops.getValue("DataManagement/ArchiveFiles/Enabled", False):
            sLog.error(
                'The "ArchiveFiles" operation is not enabled, contact your administrator!'
            )
            DIRAC.exit(1)
        for _short, longOption, _doc in self.options:
            defaultValue = ops.getValue(
                "DataManagement/ArchiveFiles/%s" % longOption, None)
            if defaultValue:
                sLog.verbose(
                    "Found default value in the CS for %r with value %r" %
                    (longOption, defaultValue))
                self.switches[longOption] = defaultValue
        for _short, longOption, _doc in self.flags:
            defaultValue = ops.getValue(
                "DataManagement/ArchiveFiles/%s" % longOption, False)
            if defaultValue:
                sLog.verbose(
                    "Found default value in the CS for %r with value %r" %
                    (longOption, defaultValue))
                self.switches[longOption] = defaultValue

        for switch in Script.getUnprocessedSwitches():
            for short, longOption, doc in self.options:
                if switch[0] == short or switch[0].lower() == longOption.lower(
                ):
                    sLog.verbose("Found switch %r with value %r" %
                                 (longOption, switch[1]))
                    self.switches[longOption] = switch[1]
                    break
            for short, longOption, doc in self.flags:
                if switch[0] == short or switch[0].lower() == longOption.lower(
                ):
                    self.switches[longOption] = True
                    break

        self.checkSwitches()
        self.switches["DryRun"] = not self.switches.get("Execute", False)
        self.switches["SourceSE"] = self.switches.get("SourceSE",
                                                      "").split(",")