Exemple #1
0
 def dsnTypeStrReport(
         inMsg,
         typeStr,
         reportType,
 ):
     if reportType == "short":
         dsnTypeShortReport(inMsg, typeStr,)
     elif reportType == "long":
         dsnTypeLongReport(inMsg, typeStr,)
     else:
         icm.EH_critical_oops()
Exemple #2
0
 def execActionStr(self, actionStr):
     if actionStr == "verify":
         return self.verify()
     elif actionStr == "show":
         return self.show()
     elif actionStr == "update":
         return self.update()
     elif actionStr == "list":
         return self.list()
     else:
         icm.EH_critical_oops("")
         return
Exemple #3
0
def dsnTypeReports(
    inMsg,
    dsnType,
    reportType,
):

    def dsnTypeStrReport(
            inMsg,
            typeStr,
            reportType,
    ):
        if reportType == "short":
            dsnTypeShortReport(inMsg, typeStr,)
        elif reportType == "long":
            dsnTypeLongReport(inMsg, typeStr,)
        else:
            icm.EH_critical_oops()

    if dsnType == DsnType.deliveryReport:
        dsnTypeStrReport(inMsg, "Delivery Report", reportType,)
        
    elif dsnType == DsnType.receiptNotification:
        dsnTypeStrReport(inMsg, "Receipt Notification", reportType,)
    
    elif dsnType == DsnType.ndrNoCoRecipients:
        dsnTypeStrReport(inMsg, "ndrNoCoRecipients", reportType,)

    elif dsnType == DsnType.ndrWithCoRecipients:
        dsnTypeStrReport(inMsg, "ndrWithCoRecipients", reportType,)
 
    elif dsnType == DsnType.tmpNonDeliveryReport:
        dsnTypeStrReport(inMsg, "tmpNonDeliveryReport", reportType,)        

    elif dsnType == DsnType.notADsn:
        dsnTypeStrReport(inMsg, "Not A DSN", reportType,)        

    else:
        icm.EH_critical_oops()
    def cmnd(
            self,
            interactive=False,  # Can also be called non-interactively
            configBaseDir=None,  # or Cmnd-Input
            bisosUserName=None,  # or Cmnd-Input
            bisosGroupName=None,  # or Cmnd-Input
            rootDir_bisos=None,  # or Cmnd-Input
            rootDir_bxo=None,  # or Cmnd-Input
            rootDir_deRun=None,  # or Cmnd-Input
            rootDir_foreignBxo=None,  # or Cmnd-Input
            argsList=[],  # or Args-Input
    ):
        cmndOutcome = self.getOpOutcome()
        if interactive:
            if not self.cmndLineValidate(outcome=cmndOutcome):
                return cmndOutcome
            effectiveArgsList = G.icmRunArgsGet().cmndArgs
        else:
            effectiveArgsList = argsList

        callParamsDict = {
            'configBaseDir': configBaseDir,
            'bisosUserName': bisosUserName,
            'bisosGroupName': bisosGroupName,
            'rootDir_bisos': rootDir_bisos,
            'rootDir_bxo': rootDir_bxo,
            'rootDir_deRun': rootDir_deRun,
            'rootDir_foreignBxo': rootDir_foreignBxo,
        }
        if not icm.cmndCallParamsValidate(
                callParamsDict, interactive, outcome=cmndOutcome):
            return cmndOutcome
        configBaseDir = callParamsDict['configBaseDir']
        bisosUserName = callParamsDict['bisosUserName']
        bisosGroupName = callParamsDict['bisosGroupName']
        rootDir_bisos = callParamsDict['rootDir_bisos']
        rootDir_bxo = callParamsDict['rootDir_bxo']
        rootDir_deRun = callParamsDict['rootDir_deRun']
        rootDir_foreignBxo = callParamsDict['rootDir_foreignBxo']

        cmndArgsSpecDict = self.cmndArgsSpec()
        if not self.cmndArgsValidate(
                effectiveArgsList, cmndArgsSpecDict, outcome=cmndOutcome):
            return cmndOutcome
####+END:
        if not configBaseDir:
            configBaseDir = configBaseDir_obtain()

        basesPolicy = self.cmndArgsGet("0", cmndArgsSpecDict,
                                       effectiveArgsList)
        rootPrefix = self.cmndArgsGet("1", cmndArgsSpecDict, effectiveArgsList)

        if basesPolicy == "bxoPolicy":
            if not bisosUserName:
                bisosUserName = bisosPolicy.bisosAccountName()

            if not bisosGroupName:
                bisosGroupName = bisosPolicy.bisosGroupName()

            if not rootDir_bisos:
                rootDir_bisos = os.path.join(rootPrefix,
                                             bisosPolicy.rootDir_bisos())

            if not rootDir_bxo:
                rootDir_bxo = os.path.join(rootPrefix,
                                           bisosPolicy.rootDir_bxo())

            if not rootDir_deRun:
                rootDir_deRun = os.path.join(rootPrefix,
                                             bisosPolicy.rootDir_deRun())

        elif basesPolicy == "foreignBxoPolicy":
            if not bisosUserName:
                return icm.EH_problem_usageError("Missing bisosUserName")

            if not bisosGroupName:
                return icm.EH_problem_usageError("Missing bisosGroupName")

            if not rootDir_foreignBxo:
                return icm.EH_problem_usageError("Missing rootDir_foreignBxo")

            if not rootDir_bisos:
                rootDir_bisos = os.path.join(rootPrefix,
                                             bisosPolicy.rootDir_bisos())

            if not rootDir_bxo:
                rootDir_bxo = os.path.join(rootPrefix,
                                           bisosPolicy.rootDir_bxo())

            if not rootDir_deRun:
                rootDir_deRun = os.path.join(rootPrefix,
                                             bisosPolicy.rootDir_deRun())

        elif basesPolicy == "externalPolicy":
            if not bisosUserName:
                return icm.EH_problem_usageError("Missing bisosUserName")

            if not bisosGroupName:
                return icm.EH_problem_usageError("Missing bisosGroupName")

            if not rootDir_foreignBxo:
                return icm.EH_problem_usageError("Missing rootDir_foreignBxo")

            if not rootDir_bisos:
                return icm.EH_problem_usageError("Missing rootDir_bisos")

            if not rootDir_bxo:
                return icm.EH_problem_usageError("Missing rootDir_bxo")

            if not rootDir_deRun:
                return icm.EH_problem_usageError("Missing rootDir_deRun")

        else:
            return icm.EH_critical_oops("basesPolicy={}".format(basesPolicy))

        pkgInfoParsSet().cmnd(
            interactive=False,
            configBaseDir=configBaseDir,
            bisosUserName=bisosUserName,
            bisosGroupName=bisosGroupName,
            rootDir_foreignBxo=rootDir_foreignBxo,
            rootDir_bisos=rootDir_bisos,
            rootDir_bxo=rootDir_bxo,
            rootDir_deRun=rootDir_deRun,
        )
Exemple #5
0
    def cmnd(self,
        interactive=False,        # Can also be called non-interactively
        icmsPkgName=None,         # or Cmnd-Input
        icmsPkgInfoBaseDir=None,         # or Cmnd-Input
        icmsPkgControlBaseDir=None,         # or Cmnd-Input
        icmsPkgRunBaseDir=None,         # or Cmnd-Input
        argsList=[],         # or Args-Input
    ):
        cmndOutcome = self.getOpOutcome()
        if interactive:
            if not self.cmndLineValidate(outcome=cmndOutcome):
                return cmndOutcome
            effectiveArgsList = G.icmRunArgsGet().cmndArgs
        else:
            effectiveArgsList = argsList

        callParamsDict = {'icmsPkgName': icmsPkgName, 'icmsPkgInfoBaseDir': icmsPkgInfoBaseDir, 'icmsPkgControlBaseDir': icmsPkgControlBaseDir, 'icmsPkgRunBaseDir': icmsPkgRunBaseDir, }
        if not icm.cmndCallParamsValidate(callParamsDict, interactive, outcome=cmndOutcome):
            return cmndOutcome
        icmsPkgName = callParamsDict['icmsPkgName']
        icmsPkgInfoBaseDir = callParamsDict['icmsPkgInfoBaseDir']
        icmsPkgControlBaseDir = callParamsDict['icmsPkgControlBaseDir']
        icmsPkgRunBaseDir = callParamsDict['icmsPkgRunBaseDir']

        cmndArgsSpecDict = self.cmndArgsSpec()
        if not self.cmndArgsValidate(effectiveArgsList, cmndArgsSpecDict, outcome=cmndOutcome):
            return cmndOutcome
####+END:
        #G = icm.IcmGlobalContext()

        #basesPolicyChoices = self.__class__.cmndArgsSpec[0]

        basesPolicy = effectiveArgsList[0]

        if not basesPolicy:
            basesPolicy = G.icmRunArgsGet().cmndArgs[0]

        print basesPolicy
        print icmsPkgInfoBaseDir

        pkgInfoParsSet().cmnd(
            interactive=False,
            icmsPkgInfoBaseDir=icmsPkgInfoBaseDir,
            icmsPkgName=icmsPkgName,  
        )

        if basesPolicy == "bisosPolicy":
            if not icmsPkgControlBaseDir:
                return icm.EH_problem_usageError("Missing Control BaseDir")

            controlPath = icmsPkgControlBaseDir
            varPath = os.path.join("/bisos", "var")
            logPath = os.path.join("/bisos", "log")            
            tmpPath = os.path.join("/bisos", "tmp")

        elif basesPolicy == "bxoPolicy":
            if not icmsPkgControlBaseDir:
                return icm.EH_problem_usageError("")

            controlPath = icmsPkgControlBaseDir
            varPath = os.path.join(icmsRunEnvBaseDir_obtain(), "var", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))
            logPath = os.path.join(icmsRunEnvBaseDir_obtain(), "log", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))            
            tmpPath = os.path.join(icmsRunEnvBaseDir_obtain(), "tmp", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))

        elif basesPolicy == "runBaseDirPolicy":
            if not icmsPkgRunBaseDir:
                return icm.EH_problem_usageError("")
            
            if icmsPkgControlBaseDir:
                controlPath = icmsPkgControlBaseDir
            else:
                controlPath = os.path.join(icmsPkgRunBaseDir, "control", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))

            varPath = os.path.join(icmsPkgRunBaseDir, "var", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))
            logPath = os.path.join(icmsPkgRunBaseDir, "log", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))            
            tmpPath = os.path.join(icmsPkgRunBaseDir, "tmp", icmsPkgName_fpObtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir))
            
        elif basesPolicy == "debianPolicy":
            controlPath = os.path.join("/etc/bystar", icmsPkgName)
            varPath = os.path.join("/var/lib/bystar/", icmsPkgName)
            logPath = os.path.join("/var/log/bystar/", icmsPkgName)            
            tmpPath = os.path.join("/tmp/bystar", icmsPkgName)
            
        elif basesPolicy == "centosPolicy":
            controlPath = os.path.join("/etc/bystar", icmsPkgName)
            varPath = os.path.join("/var/lib/bystar/", icmsPkgName)
            logPath = os.path.join("/var/log/bystar/", icmsPkgName)            
            tmpPath = os.path.join("/tmp/bystar", icmsPkgName)
            
        else:
            return icm.EH_critical_oops("basesPolicy={}".format(basesPolicy))

        pkgInfoParsSet().cmnd(
            interactive=False,
            icmsPkgInfoBaseDir=icmsPkgInfoBaseDir,
            icmsPkgBasesPolicy=basesPolicy,
            icmsPkgControlBaseDir=controlPath,
            icmsPkgVarBaseDir=varPath,
            icmsPkgLogBaseDir=logPath,            
            icmsPkgTmpBaseDir=tmpPath,
        )