Exemplo n.º 1
0
def logBaseDir_obtain(
    icmsPkgInfoBaseDir=None,
    bxoId=None,
    sr=None,
):
    if bxoId:
        return (
            serviceObject.bxoSr_runBaseObtain_log(
                bxoId,
                sr,
            )
        )

    if icmsPkgInfoBaseDir:
        return(
            icm.FILE_ParamValueReadFrom(
                parRoot= os.path.abspath("{}/pkgInfo/fp".format(icmsPkgInfoBaseDir)),
                parName="icmsPkgLogBaseDir")
        )
    else:
        return(
            icm.FILE_ParamValueReadFrom(
                parRoot="../pkgInfo/fp",
                parName="icmsPkgLogBaseDir")
        )
Exemplo n.º 2
0
def controlBaseDir_obtain(
    icmsPkgInfoBaseDir,
    bxoId=None,
    sr=None,
):
####+END:
    if bxoId:
        return (
            serviceObject.srFullPathBaseDir_obtain(
                bxoId,
                sr,
            )
        )
    
    if icmsPkgInfoBaseDir:
        return(
            icm.FILE_ParamValueReadFrom(
                parRoot= os.path.abspath("{}/pkgInfo/fp".format(icmsPkgInfoBaseDir)),
                parName="icmsPkgControlBaseDir")
        )
    else:
        return(
            icm.FILE_ParamValueReadFrom(
                parRoot="../pkgInfo/fp",
                parName="icmsPkgControlBaseDir")
        )
Exemplo n.º 3
0
def icmsPkgName_fpObtain(icmsPkgInfoBaseDir=None, ):
    """NOTYET -- Called obtain to leave Get for the IIF"""
    return icm.FILE_ParamValueReadFrom(
        parRoot=os.path.join(
            pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), ),
        parName="icmsPkgName",
    )
Exemplo n.º 4
0
def sr_fpObtain(configBaseDir, ):
    ####+END:
    if not configBaseDir:
        configBaseDir = configBaseDir_obtain()

    return (icm.FILE_ParamValueReadFrom(parRoot=os.path.abspath(
        "{}/pkgInfo/fp".format(configBaseDir)),
                                        parName="sr"))
Exemplo n.º 5
0
def icmsPkgControlBaseDir_fpObtain():
    """NOTYET -- Called obtain to leave Get for the IIF"""
    return icm.FILE_ParamValueReadFrom(
        parRoot=os.path.join(
            pkgInfoFpBaseDir_obtain(),            
        ),
        parName="icmsPkgControlBaseDir",        
    )
Exemplo n.º 6
0
                    def paramProc(thisParam):
                        """At this point, we have the target and the parameter, ready for processing.
                        - From thisParam's fileParams, get the agent and parName, 
                        - Then remoteExec the agent on target and get the results.
                        - Record the obtained results with local invokation of the agent.
                        """

                        icm.TM_here(
                            'targetPath=' +
                            thisPathTarget)  # Target Access Information
                        icm.TM_here(format('ticmoBase=' +
                                           thisTicmoBase))  # TICMO Base

                        paramBase = thisParam.base()
                        icm.TM_here('paramBase=' + paramBase)

                        agent = icm.FILE_ParamValueReadFrom(parRoot=paramBase,
                                                            parName='agent')
                        if not agent: return (icm.EH_problem_unassignedError())

                        parName = icm.FILE_ParamValueReadFrom(
                            parRoot=paramBase, parName='parName')
                        if not parName:
                            return (icm.EH_problem_unassignedError())

                        commandLine = format(agent + ' -p mode=agent -i ' +
                                             parName)
                        icm.LOG_here('RemoteExec: ' + commandLine)

                        resultLines = linuxTarget.runCommand(
                            connection, commandLine)

                        pipeableResultLines = ""
                        for thisResultLine in resultLines:
                            pipeableResultLines = pipeableResultLines + thisResultLine + '\n'

                        icm.LOG_here('ResultLines: ' + str(resultLines))

                        # We can now dateVer and empnaPkg write the resultLines for parName in TICMO
                        #fileParWriteBase = os.path.join(thisTicmoBase, empnaPkg, dateVer)

                        # updated =  icm.FILE_ParamWriteTo(parRoot=fileParWriteBase,
                        #                               parName=parName,
                        #                               parValue=resultLines[0])

                        #
                        # We ask the agent to capture the resultLines in ticmo
                        #
                        commandLine = format(
                            agent + ' ' +
                            '-n showRun -p mode=capture -p ticmoBase=' +
                            ' -i ' + parName)
                        commandArgs = shlex.split(commandLine)

                        icm.LOG_here('SubProc: ' + commandLine)
                        p = subprocess.Popen(commandArgs,
                                             stdin=subprocess.PIPE,
                                             stdout=subprocess.PIPE,
                                             stderr=subprocess.PIPE)

                        out, err = p.communicate(
                            input=format(pipeableResultLines.encode()))

                        if out: icm.ANN_note("Stdout: " + out)
                        if err: icm.ANN_note("Stderr: " + err)

                        return