def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='Default KIDS Installer', parents=[testClientParser]) parser.add_argument('kidsFile', help='path to KIDS Build file') parser.add_argument('-l', '--logFile', default=None, help='path to logFile') parser.add_argument('-r', '--reinstall', default=False, action='store_true', help='whether re-install the KIDS even it is already installed') parser.add_argument('-g', '--globalFiles', default=None, nargs='*', help='list of global files that need to import') result = parser.parse_args(); print (result) testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient: kidsFile = os.path.abspath(result.kidsFile) from KIDSBuildParser import KIDSBuildParser kidsParser = KIDSBuildParser(None) kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION) kidsParser.parseKIDSBuild(kidsFile) installNameList = kidsParser.installNameList installName = installNameList[0] multiBuildList = installNameList if len(installNameList) == 1: multiBuildList = None defaultKidsInstall = DefaultKIDSBuildInstaller(kidsFile, installName, logFile=result.logFile, multiBuildList=multiBuildList, globals=result.globalFiles) defaultKidsInstall.runInstallation(testClient, result.reinstall)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='Default KIDS Installer', parents=[testClientParser]) parser.add_argument('kidsFile', metavar='K', help='path to KIDS Build file') parser.add_argument('installName', metavar='I', help='kids install name') parser.add_argument('-l', '--logFile', default=None, help='path to logFile') parser.add_argument('-r', '--reinstall', default=False, action='store_true', help='whether re-install the KIDS even it is already installed') parser.add_argument('-m', '--multiBuildList', default=None, nargs='*', help='list of multibuild install names') parser.add_argument('-g', '--globalFiles', default=None, nargs='*', help='list of global files that need to import') result = parser.parse_args(); print (result) testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient: kidsFile = os.path.abspath(result.kidsFile) defaultKidsInstall = DefaultKIDSPatchInstaller(kidsFile, result.installName, logFile=result.logFile, multiBuildList=result.multiBuildList, globals=result.globalFiles) defaultKidsInstall.runInstallation(testClient, result.reinstall)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='FOIA Patch Sequence Analyzer', parents=[testClientParser]) parser.add_argument('-f', '--foiaBranch', required=True, help='input the branch name from which the global files are downloaded') parser.add_argument('-r', '--foiaRemote', required=False, default="https://raw.githubusercontent.com/OSEHRA-Sandbox/VistA-M/", help='input the VistA-M repository from which the global files are downloaded, must be a link to the raw data.\ Default remote is: https://raw.githubusercontent.com/OSEHRA-Sandbox/VistA-M/ ') parser.add_argument('-t', '--tmpDir', required=True, help='input the filepath to a directory to download the necessary global files') parser.add_argument('-g', '--gtmDir', required=False, help='input the filepath to a directory where GT.M stores its routines') parser.add_argument('-i', '--install', required=False, action="store_true", help='Attempt to install global files with ^ZGI?') parser.add_argument('-l', '--log', required=False, help='File to which I would log VistA communication') result = parser.parse_args(); """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() if result.log: testClient.setLogFile(result.log) with testClient as vistaClient: update = updateMFSGlobals() update.updateMFSGlobalFiles(vistaClient,result.foiaBranch, result.foiaRemote,result.tmpDir, result.gtmDir, result.install)
def main(): import logging initConsoleLogging(logging.INFO) testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA Taskman Utilities', parents=[testClientParser]) parser.add_argument( '-a', '--action', required=True, choices=['Start', 'Stop', 'Shutdown'], help= 'Start:Start Taskman, Stop:Stop Taskman, Shutdown:Shutdown all tasks') result = parser.parse_args() print result """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: logFilename = getTempLogFile(DEFAULT_OUTPUT_LOG_FILE_NAME) print "Log File is %s" % logFilename vistAClient.setLogFile(logFilename) taskmanUtil = VistATaskmanUtil() actionMap = { "Start": taskmanUtil.startTaskman, "Stop": taskmanUtil.stopTaskman, "Shutdown": taskmanUtil.shutdownAllTasks } actionMap[result.action](vistAClient)
def testIsInstallCompleted(): testClient = createTestClient() assert testClient import logging with testClient: initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) installNameLst = [ "ECLAIMS 5 BUNDLE 1.0", "TEST 1.0", "XOBU 1.6", "LR*5.2*334", "XU*8.0*80", "TERATOGENIC MEDICATIONS ORDER CHECKS 1.0" ] for installName in installNameLst: result = packagePatchHist.isPatchInstalled(installName) if not result: print("%s installation status is %s" % (installName, "Not Installed")) else: print("%s installation status is %s" % (installName, "Installed")) result = packagePatchHist.getInstallationStatus(installName) if packagePatchHist.isNotInstalled(result): print("%s installation status is %s" % (installName, "Not Installed")) else: print("%s installation status is %s" % (installName, packagePatchHist.PATCH_INSTALL_STATUS_LIST[result]))
def main(): parser = argparse.ArgumentParser(description='VistA KIDS Patch Parser') parser.add_argument('-i', '--inputFile', required=True, help = 'Input KIDS Patch file or Invidual Routine File') parser.add_argument('-o', '--outputDir', default=None, help = 'Output directory to store extracted M routines') parser.add_argument('-c', '--checksum', default=False, action="store_true", help = 'Print checksum of a M Routine') parser.add_argument('-v', '--verify', default=False, action="store_true", help = 'verify a KIDS patch') result = parser.parse_args(); import logging initConsoleLogging(logging.INFO) if result.checksum: chksum= checksum(result.inputFile) sys.stdout.write("Checksum is: %s\n" % chksum) elif result.verify: kidsParser = KIDSPatchParser(result.outputDir) ret = kidsParser.verifyKidsPatch(result.inputFile) if ret: logger.info("%s is valid" % result.inputFile) else: logger.error("%s is invalid" % result.inputFile) else: kidsParser = KIDSPatchParser(result.outputDir) kidsParser.parseKIDSBuild(result.inputFile) kidsParser.printResult()
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA M Component Extractor', parents=[testClientParser]) parser.add_argument('-o', '--outputDir', required=True, help='output Dir to store global/routine export files') parser.add_argument('-r', '--vistARepo', required=True, help='path to the top directory of VistA-M repository') parser.add_argument( '-l', '--logDir', required=True, help='path to the top directory to store the log files') parser.add_argument( '-ro', '--routineOutDir', default=None, help='path to the directory where GT. M stores routines') result = parser.parse_args() print(result) outputDir = result.outputDir assert os.path.exists(outputDir) initConsoleLogging() """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: vistADataExtractor = VistADataExtractor(result.vistARepo, outputDir, result.logDir, result.routineOutDir) vistADataExtractor.extractData(testClient)
def main(): parser = argparse.ArgumentParser(description='VistA KIDS Build Parser') parser.add_argument('-i', '--inputFile', required=True, help = 'Input KIDS Build file or Invidual Routine File') parser.add_argument('-o', '--outputDir', default=None, help = 'Output directory to store extracted M routines') parser.add_argument('-c', '--checksum', default=False, action="store_true", help = 'Print checksum of a M Routine') parser.add_argument('-v', '--verify', default=False, action="store_true", help = 'verify a KIDS Build') parser.add_argument('-j', '--jsonOutputFile', default=None, help = 'output metadata as json format') result = parser.parse_args(); import logging initConsoleLogging(logging.INFO) if result.checksum: chksum= checksum(result.inputFile) sys.stdout.write("Checksum is: %s\n" % chksum) elif result.verify: kidsParser = KIDSBuildParser(result.outputDir) ret = kidsParser.verifyKIDSBuild(result.inputFile) if ret: logger.info("%s is valid" % result.inputFile) else: logger.error("%s is invalid" % result.inputFile) else: kidsParser = KIDSBuildParser(result.outputDir) kidsParser.parseKIDSBuild(result.inputFile) kidsParser.printResult() if result.jsonOutputFile: outputMetaDataInJSON(kidsParser, result.jsonOutputFile) loadMetaDataFromJSON(result.jsonOutputFile)
def testIsInstallCompleted(): testClient = createTestClient() assert testClient import logging with testClient: initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) installNameLst = [ "ECLAIMS 5 BUNDLE 1.0", "TEST 1.0", "XOBU 1.6", "LR*5.2*334", "XU*8.0*80", "TERATOGENIC MEDICATIONS ORDER CHECKS 1.0" ] for installName in installNameLst: result = packagePatchHist.isPatchInstalled(installName) if not result: print ("%s installation status is %s" % (installName, "Not Installed")) else: print ("%s installation status is %s" % (installName, "Installed")) result = packagePatchHist.getInstallationStatus(installName) if packagePatchHist.isNotInstalled(result): print ("%s installation status is %s" % (installName, "Not Installed")) else: print ("%s installation status is %s" % (installName, packagePatchHist.PATCH_INSTALL_STATUS_LIST[result]))
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA M Component Extractor', parents=[testClientParser]) parser.add_argument('-o', '--outputDir', required=True, help='output Dir to store global/routine export files') parser.add_argument('-r', '--vistARepo', required=True, help='path to the top directory of VistA-M repository') parser.add_argument('-l', '--logDir', required=True, help='path to the top directory to store the log files') parser.add_argument('-ro', '--routineOutDir', default=None, help='path to the directory where GT. M stores routines') parser.add_argument('-sx', '--serialize', default=False, action="store_true", help = 'export the globals serially (Needed on on single-user Cache instace)') result = parser.parse_args(); print (result) outputDir = result.outputDir assert os.path.exists(outputDir) initConsoleLogging() """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: vistADataExtractor = VistADataExtractor(result.vistARepo, outputDir, result.logDir, result.routineOutDir, serialExport = result.serialize) vistADataExtractor.extractData(testClient)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser( description='FOIA Patch Sequence Analyzer', parents=[testClientParser]) parser.add_argument( '-p', '--patchFileDir', required=True, help='input file path to the folder that contains all the FOIA patches' ) parser.add_argument( '-l', '--logDir', required=True, help='Output dirctory to store all log file information') parser.add_argument('-i', '--install', default=False, action="store_true", help='whether to install Patch or not') group = parser.add_mutually_exclusive_group() group.add_argument('-n', '--numOfPatch', default=1, help="input All for all patches, " "otherwise just enter number, default is 1") group.add_argument('-u', '--upToPatch', help="install patches up to specified install name") group.add_argument('-o', '--onlyPatch', help='install specified patch and required patches only' ', this option will ignore the CSV dependencies') result = parser.parse_args() print(result) inputPatchDir = result.patchFileDir assert os.path.exists(inputPatchDir) outputDir = result.logDir assert os.path.exists(outputDir) """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient as vistAClient: patchSeqApply = PatchSequenceApply(vistAClient, outputDir) if result.upToPatch: patchSeqApply.generatePatchSequence(inputPatchDir, result.upToPatch, True) else: patchSeqApply.generatePatchSequence(inputPatchDir, result.onlyPatch) if result.install: if result.onlyPatch: patchSeqApply.applyPatchSequenceByNumber("All") elif result.upToPatch: patchSeqApply.applyPatchSequenceByInstallName(result.upToPatch) else: patchSeqApply.applyPatchSequenceByNumber(result.numOfPatch)
def testGeneratePatchOrder(): import logging initConsoleLogging(logging.INFO) kidsInfoGen = KIDSPatchOrderGenerator() if len(sys.argv) <= 1: sys.stderr.write("Specify patch directory") sys.exit(-1) kidsInfoGen.generatePatchOrder(sys.argv[1])
def __setupLogging__(self, vistATestClient): DEFAULT_LOGGING_FILENAME = "VistADataExtractor.log" DEFAULT_EXPECT_LOG_FILENAME = "VistAPExpect.log" vistATestClient.setLogFile(os.path.join(self._outputLogDir, DEFAULT_EXPECT_LOG_FILENAME)) initConsoleLogging() initFileLogging(os.path.join(self._outputLogDir, DEFAULT_LOGGING_FILENAME))
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='Default KIDS Installer', parents=[testClientParser]) parser.add_argument('kidsFile', help='path to KIDS Build file') parser.add_argument('-l', '--logFile', default=None, help='path to logFile') parser.add_argument( '-r', '--reinstall', default=False, action='store_true', help='whether re-install the KIDS even it is already installed') parser.add_argument( '-t', '--tglobalprint', default=None, help='folder to hold a printout of Transport global information') parser.add_argument('-g', '--globalFiles', default=None, nargs='*', help='list of global files that need to import') parser.add_argument('-d', '--duz', default=DEFAULT_INSTALL_DUZ, type=int, help='installer\'s VistA instance\'s DUZ') result = parser.parse_args() print(result) testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient: kidsFile = os.path.abspath(result.kidsFile) from KIDSBuildParser import KIDSBuildParser kidsParser = KIDSBuildParser(None) kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION) kidsParser.parseKIDSBuild(kidsFile) installNameList = kidsParser.installNameList installName = installNameList[0] multiBuildList = installNameList if len(installNameList) == 1: multiBuildList = None defaultKidsInstall = DefaultKIDSBuildInstaller( kidsFile, installName, logFile=result.logFile, multiBuildList=multiBuildList, duz=result.duz, globals=result.globalFiles, printTG=result.tglobalprint) defaultKidsInstall.runInstallation(testClient, result.reinstall)
def testGeneratePatchOrder(): import logging initConsoleLogging(logging.INFO) kidsInfoGen = KIDSPatchOrderGenerator() if len(sys.argv) <= 1: sys.stderr.write("Specify patch directory") sys.exit(-1) if len(sys.argv) == 2: kidsInfoGen.generatePatchOrder(sys.argv[1]) else: kidsInfoGen.generatePatchOrder(sys.argv[1], sys.argv[2])
def testGeneratePatchOrder(): import logging initConsoleLogging(logging.INFO) patchOrderGen = PatchOrderGenerator() if len(sys.argv) <= 1: sys.stderr.write("Specify patch directory") sys.exit(-1) if len(sys.argv) == 2: patchOrderGen.generatePatchOrder(sys.argv[1]) else: patchOrderGen.generatePatchOrder(sys.argv[1], sys.argv[2])
def __init__(self, testClient, logFileDir): self._testClient = testClient curTimestamp = getCurrentTimestamp() logFileName = "%s.%s" % (self.DEFAULT_VISTA_LOG_FILENAME, curTimestamp) self._logFileName = os.path.join(logFileDir, logFileName) self._testClient.setLogFile(self._logFileName) self._kidsOrderGen = KIDSPatchOrderGenerator() self._vistaPatchInfo = VistAPackageInfoFetcher(testClient) self._outPatchList = [] self._patchSet = set() initConsoleLogging() initFileLogging(os.path.join(logFileDir, self.DEFAULT_OUTPUT_FILE_LOG))
def __init__(self, testClient, logFileDir): self._testClient = testClient curTimestamp = getCurrentTimestamp() logFileName = "%s.%s" % (self.DEFAULT_VISTA_LOG_FILENAME, curTimestamp) self._logFileName = os.path.join(logFileDir, logFileName) self._testClient.setLogFile(self._logFileName) self._patchOrderGen = PatchOrderGenerator() self._vistaPatchInfo = VistAPackageInfoFetcher(testClient) self._outPatchList = [] self._patchSet = set() initConsoleLogging() initFileLogging(os.path.join(logFileDir, self.DEFAULT_OUTPUT_FILE_LOG))
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser( description='FOIA Patch Sequence Analyzer', parents=[testClientParser]) parser.add_argument( '-f', '--foiaBranch', required=True, help='input the branch name from which the global files are downloaded' ) parser.add_argument( '-r', '--foiaRemote', required=False, default="https://raw.githubusercontent.com/OSEHRA-Sandbox/VistA-M/", help= 'input the VistA-M repository from which the global files are downloaded, must be a link to the raw data.\ Default remote is: https://raw.githubusercontent.com/OSEHRA-Sandbox/VistA-M/ ' ) parser.add_argument( '-t', '--tmpDir', required=True, help= 'input the filepath to a directory to download the necessary global files' ) parser.add_argument( '-g', '--gtmDir', required=False, help='input the filepath to a directory where GT.M stores its routines' ) parser.add_argument('-i', '--install', required=False, action="store_true", help='Attempt to install global files with ^ZGI?') parser.add_argument('-l', '--log', required=False, help='File to which I would log VistA communication') result = parser.parse_args() """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() if result.log: testClient.setLogFile(result.log) with testClient as vistaClient: update = updateMFSGlobals() update.updateMFSGlobalFiles(vistaClient, result.foiaBranch, result.foiaRemote, result.tmpDir, result.gtmDir, result.install)
def testGeneratePatchOrder(): import logging initConsoleLogging(logging.INFO) patchOrderGen = PatchOrderGenerator() if len(sys.argv) <= 1: sys.stderr.write("Specify patch directory") sys.exit(-1) result = [] if len(sys.argv) == 2: result = patchOrderGen.generatePatchOrder(sys.argv[1]) else: result = patchOrderGen.generatePatchOrder(sys.argv[1], sys.argv[2]) printPatchOrderList(result)
def main(): initConsoleLogging() import argparse from VistATestClient import createTestClientArgParser from VistATestClient import VistATestClientFactory testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='Intersystem Cache Classes Importer', parents=[testClientParser]) parser.add_argument('srcDir', help='source directory that stores all exported classes') result = parser.parse_args() testClient = VistATestClientFactory.createVistATestClientWithArgs(result) with testClient: importCacheClass(testClient, result.srcDir)
def test1(): result = getInputArgumentResult() outputDir = result.outputDir assert os.path.exists(outputDir) initConsoleLogging() """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: vistADataExtractor = VistADataExtractor(result.vistARepo, outputDir, result.logDir, result.routineOutDir) vistADataExtractor.__exportAllCacheClasses__(testClient)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='FOIA Patch Sequence Analyzer', parents=[testClientParser]) parser.add_argument('-p', '--patchFileDir', required=True, help='input file path to the folder that contains all the FOIA patches') parser.add_argument('-l', '--logDir', required=True, help='Output dirctory to store all log file information') parser.add_argument('-i', '--install', default=False, action="store_true", help = 'whether to install Patch or not') group = parser.add_mutually_exclusive_group() group.add_argument('-n', '--numOfPatch', default=1, help="input All for all patches, " "otherwise just enter number, default is 1") group.add_argument('-u', '--upToPatch', help="install patches up to specified install name") group.add_argument('-o', '--onlyPatch', help='install specified patch and required patches only' ', this option will ignore the CSV dependencies') parser.add_argument('-d', '--duz', default=17, type=int, help='installer\'s VistA instance\'s DUZ') result = parser.parse_args(); print (result) inputPatchDir = result.patchFileDir assert os.path.exists(inputPatchDir) outputDir = result.logDir assert os.path.exists(outputDir) """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) testClient2 = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient as vistAClient: patchSeqApply = PatchSequenceApply(vistAClient, outputDir) patchSeqApply._duz = result.duz assert testClient2 with testClient2 as vistAClient2: patchSeqApply._testClient2 = vistAClient2 if result.upToPatch: patchSeqApply.generatePatchSequence(inputPatchDir, result.upToPatch, True) else: patchSeqApply.generatePatchSequence(inputPatchDir, result.onlyPatch) if result.install: if result.onlyPatch: patchSeqApply.applyPatchSequenceByNumber("All") elif result.upToPatch: patchSeqApply.applyPatchSequenceByInstallName(result.upToPatch) else: patchSeqApply.applyPatchSequenceByNumber(result.numOfPatch)
def main(): testClient = createTestClient() assert testClient import logging with testClient: import pprint initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) packagePatchHist.getPackagePatchHistByNamespace("DI") packagePatchHist.printPackagePatchHist("VA FILEMAN") output = packagePatchHist.getAllPatchesInstalledByTime(datetime(2012,8,24)) pprint.pprint(output) output = packagePatchHist.getAllPatchInstalledAfterByTime("T-365") pprint.pprint(output)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA Test Client Demo', parents=[testClientParser]) result = parser.parse_args(); print (result) import logging initConsoleLogging(logging.INFO) testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient """ this is to test the context manager to make sure the resource is clean up even there is an exception """ with testClient as client: raise Exception("Test Exception")
def main(): initConsoleLogging() import argparse from VistATestClient import createTestClientArgParser from VistATestClient import VistATestClientFactory testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser( description='Intersystem Cache Classes Importer', parents=[testClientParser]) parser.add_argument( 'srcDir', help='source directory that stores all exported classes') result = parser.parse_args() testClient = VistATestClientFactory.createVistATestClientWithArgs(result) with testClient: importCacheClass(testClient, result.srcDir)
def main(): testClient = createTestClient() assert testClient import logging with testClient: import pprint initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) packagePatchHist.getPackagePatchHistByNamespace("DI") packagePatchHist.printPackagePatchHist("VA FILEMAN") output = packagePatchHist.getAllPatchesInstalledByTime( datetime(2012, 8, 24)) pprint.pprint(output) output = packagePatchHist.getAllPatchInstalledAfterByTime("T-365") pprint.pprint(output)
def main(): initConsoleLogging() parser = argparse.ArgumentParser( description='Generate VistA M Components reference repo READMEs') parser.add_argument('-i', '--inputDir', required=True, help='path to VistA Respository') parser.add_argument('-o', '--outputMReposDir', required=True, help='top dir of VistA M Component repository') parser.add_argument('-l', '--logFile', default = None, help='output log file, default is no') result = parser.parse_args(); logger.info (result) if result.logFile: initFileLogging(result.logFile) readMeGen = MCompReposReadMeGenerator(result.inputDir, result.outputMReposDir) readMeGen.generatePackageReadMes()
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA Initialize FileMan Utilities', parents=[testClientParser]) parser.add_argument('roFile', help="routine import file in ro format") result = parser.parse_args(); print (result) """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: logFilename = getTempLogFile() print "Log File is %s" % logFilename initConsoleLogging() vistAClient.setLogFile(logFilename) installFileMan22_2(vistAClient, result.roFile)
def main(): testClient = createTestClient() assert testClient import logging with testClient: import pprint initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) packagePatchHist.getPackagePatchHistByNamespace("DI", "22.0") packagePatchHist.printPackagePatchHist("VA FILEMAN") ver = getPackageLatestVersionByNamespace("DI", testClient) print "the latest version is [%s]" % ver output = packagePatchHist.getAllPatchesInstalledByTime(datetime(2012,8,24)) pprint.pprint(output) output = packagePatchHist.getAllPatchInstalledAfterByTime("T-1000") pprint.pprint(output)
def testMain(): testClient = createTestClient() with testClient: initConsoleLogging() packagePatchHist = VistAPackageInfoFetcher(testClient) #packagePatchHist.getAllPackagesPatchHistory() packagePatchHist.getPackagePatchHistByName("TOOLKIT") packagePatchHist.printPackageLastPatch("TOOLKIT") packagePatchHist.getPackagePatchHistByName("IMAGING") packagePatchHist.printPackageLastPatch("IMAGING") packagePatchHist.getPackagePatchHistByNamespace("VPR") packagePatchHist.printPackagePatchHist("VIRTUAL PATIENT RECORD") packagePatchHist.printPackageLastPatch("VIRTUAL PATIENT RECORD") packagePatchHist.getPackagePatchHistByNamespace("DENT") packagePatchHist.printPackagePatchHist("DENTAL") packagePatchHist.getPackagePatchHistByNamespace("NUPA") packagePatchHist.printPackagePatchHist("PATIENT ASSESSMENT DOCUM")
def main(): testClient = createTestClient() assert testClient import logging with testClient: import pprint initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) packagePatchHist.getPackagePatchHistByNamespace("DI", "22.0") packagePatchHist.printPackagePatchHist("VA FILEMAN") ver = getPackageLatestVersionByNamespace("DI", testClient) print("the latest version is [%s]" % ver) output = packagePatchHist.getAllPatchesInstalledByTime( datetime(2012, 8, 24)) pprint.pprint(output) output = packagePatchHist.getAllPatchInstalledAfterByTime("T-1000") pprint.pprint(output)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description="Default KIDS Installer", parents=[testClientParser]) parser.add_argument("kidsFile", help="path to KIDS Build file") parser.add_argument("-l", "--logFile", default=None, help="path to logFile") parser.add_argument( "-r", "--reinstall", default=False, action="store_true", help="whether re-install the KIDS even it is already installed", ) parser.add_argument( "-t", "--tglobalprint", default=None, help="folder to hold a printout of Transport global information" ) parser.add_argument("-g", "--globalFiles", default=None, nargs="*", help="list of global files that need to import") parser.add_argument("-d", "--duz", default=DEFAULT_INSTALL_DUZ, type=int, help="installer's VistA instance's DUZ") result = parser.parse_args() print(result) testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient initConsoleLogging() with testClient: kidsFile = os.path.abspath(result.kidsFile) from KIDSBuildParser import KIDSBuildParser kidsParser = KIDSBuildParser(None) kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION) kidsParser.parseKIDSBuild(kidsFile) installNameList = kidsParser.installNameList installName = installNameList[0] multiBuildList = installNameList if len(installNameList) == 1: multiBuildList = None defaultKidsInstall = DefaultKIDSBuildInstaller( kidsFile, installName, logFile=result.logFile, multiBuildList=multiBuildList, duz=result.duz, globals=result.globalFiles, printTG=result.tglobalprint, ) defaultKidsInstall.runInstallation(testClient, result.reinstall)
def main(): initConsoleLogging() parser = argparse.ArgumentParser( description='Convert Patch Data to external data format') parser.add_argument('-i', '--inputDir', required=True, help='path to top leve directory to convert all patch data') parser.add_argument('-e', '--externalDataDir', required=False, default=None, help='output dir to store the external data, default is inplace') parser.add_argument('-g', '--gitignore', required=False, default=False, action="store_true", help='Add original file to .gitignore, default is not') parser.add_argument('-l', '--logFile', default = None, help='output log file, default is no') result = parser.parse_args(); logger.info (result) if result.logFile: initFileLogging(result.logFile) converter = ExternalDataConverter(result.externalDataDir, result.gitignore) converter.convertCurrentDir(result.inputDir)
def main(): testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description="VistA M Component Extractor", parents=[testClientParser]) parser.add_argument("-o", "--outputDir", required=True, help="output Dir to store global/routine export files") parser.add_argument("-r", "--vistARepo", required=True, help="path to the top directory of VistA-M repository") parser.add_argument("-l", "--logDir", required=True, help="path to the top directory to store the log files") parser.add_argument( "-ro", "--routineOutDir", default=None, help="path to the directory where GT. M stores routines" ) result = parser.parse_args() print(result) outputDir = result.outputDir assert os.path.exists(outputDir) initConsoleLogging() """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: vistADataExtractor = VistADataExtractor(result.vistARepo, outputDir, result.logDir, result.routineOutDir) vistADataExtractor.extractData(testClient)
def testMain(): testClient = createTestClient() import logging with testClient: initConsoleLogging(logging.INFO) packagePatchHist = VistAPackageInfoFetcher(testClient) packagePatchHist.getAllPackagesPatchHistory() packagePatchHist.getPackagePatchHistByName("TOOLKIT") packagePatchHist.printPackageLastPatch("TOOLKIT") packagePatchHist.getPackagePatchHistByNamespace("FMDC") packagePatchHist.printPackagePatchHist("FILEMAN DELPHI COMPONENTS") packagePatchHist.getPackagePatchHistByName("IMAGING") packagePatchHist.printPackageLastPatch("IMAGING") packagePatchHist.getPackagePatchHistByNamespace("VPR") packagePatchHist.printPackagePatchHist("VIRTUAL PATIENT RECORD") packagePatchHist.printPackageLastPatch("VIRTUAL PATIENT RECORD") packagePatchHist.getPackagePatchHistByNamespace("DENT") packagePatchHist.printPackagePatchHist("DENTAL") packagePatchHist.getPackagePatchHistByNamespace("NUPA") packagePatchHist.printPackagePatchHist("PATIENT ASSESSMENT DOCUM")
def downloadAllKIDSSha1File(topDir, cacheDir): from ConvertToExternalData import isValidKIDSBuildSha1Suffix from ConvertToExternalData import readSha1SumFromSha1File import shutil initConsoleLogging() absCurDir = os.path.abspath(topDir) for (root, dirs, files) in os.walk(absCurDir): for f in files: if not isValidKIDSBuildSha1Suffix(f): continue filePath = os.path.join(root, f) sha1Sum = readSha1SumFromSha1File(filePath) result, extFilePath = obtainKIDSBuildFileBySha1(filePath, sha1Sum, cacheDir) if result: destFile = filePath[:filePath.rfind('.')] if os.path.exists(destFile) and generateSha1Sum(destFile) == sha1Sum: logger.info("%s is already current" % destFile) continue logger.info("%s => %s" % (extFilePath, destFile)) shutil.copyfile(extFilePath, destFile)
def main(): initConsoleLogging() parser = argparse.ArgumentParser( description='Convert Patch Data to external data format') parser.add_argument( '-i', '--inputDir', required=True, help='path to top leve directory to convert all patch data') parser.add_argument('-e', '--externalDataDir', required=False, default=None, help='output dir to store the external data,' ' default is inplace') parser.add_argument('-g', '--gitignore', required=False, default=False, action="store_true", help='Add original file to .gitignore, default is not') parser.add_argument('-s', '--size', default=1, type=int, help='file size threshold to be converted to external ' 'data, unit is MiB, default is 1(MiB)') parser.add_argument('-l', '--logFile', default=None, help='output log file, default is no') result = parser.parse_args() logger.info(result) if result.logFile: initFileLogging(result.logFile) converter = ExternalDataConverter( result.externalDataDir, result.gitignore, result.size * EXTERNAL_DATA_SIZE_THRESHOLD) converter.convertCurrentDir(result.inputDir)
def main(): initConsoleLogging() parser = argparse.ArgumentParser( description='Generate VistA M Components reference repo READMEs') parser.add_argument('-i', '--inputDir', required=True, help='path to VistA Respository') parser.add_argument('-o', '--outputMReposDir', required=True, help='top dir of VistA M Component repository') parser.add_argument('-l', '--logFile', default=None, help='output log file, default is no') result = parser.parse_args() logger.info(result) if result.logFile: initFileLogging(result.logFile) readMeGen = MCompReposReadMeGenerator(result.inputDir, result.outputMReposDir) readMeGen.generatePackageReadMes()
def main(): import logging initConsoleLogging(logging.INFO) testClientParser = createTestClientArgParser() parser = argparse.ArgumentParser(description='VistA Taskman Utilities', parents=[testClientParser]) parser.add_argument('-a', '--action', required=True, choices=['Start', 'Stop', 'Shutdown'], help='Start:Start Taskman, Stop:Stop Taskman, Shutdown:Shutdown all tasks') result = parser.parse_args(); print result """ create the VistATestClient""" testClient = VistATestClientFactory.createVistATestClientWithArgs(result) assert testClient with testClient as vistAClient: logFilename = getTempLogFile(DEFAULT_OUTPUT_LOG_FILE_NAME) print "Log File is %s" % logFilename vistAClient.setLogFile(logFilename) taskmanUtil = VistATaskmanUtil() actionMap = {"Start": taskmanUtil.startTaskman, "Stop": taskmanUtil.stopTaskman, "Shutdown": taskmanUtil.shutdownAllTasks} actionMap[result.action](vistAClient)
def main(): initConsoleLogging() parser = argparse.ArgumentParser( description='Convert Patch Data to external data format') parser.add_argument('-i', '--inputDir', required=True, help='path to top leve directory to convert all patch data') parser.add_argument('-e', '--externalDataDir', required=False, default=None, help='output dir to store the external data,' ' default is inplace') parser.add_argument('-g', '--gitignore', required=False, default=False, action="store_true", help='Add original file to .gitignore, default is not') parser.add_argument('-s', '--size', default=1, type=int, help='file size threshold to be converted to external ' 'data, unit is MiB, default is 1(MiB)') parser.add_argument('-l', '--logFile', default=None, help='output log file, default is no') result = parser.parse_args(); logger.info (result) if result.logFile: initFileLogging(result.logFile) converter = ExternalDataConverter(result.externalDataDir, result.gitignore, result.size*EXTERNAL_DATA_SIZE_THRESHOLD) converter.convertCurrentDir(result.inputDir)
def main(): import logging initConsoleLogging(logging.INFO) connArgs = getTestClientConnArg("VistA Test Client Tests") testConnection(connArgs) testExceptionSafe(connArgs)
extractLogDir, gitBranch=mRepoBranch) MExtractor.extractData(testClient) commit = MCompReposCommitter(mRepo) commit.commit(commitFile) if backupConfig: backupDir = backupConfig['backup_dir'] if not os.path.exists(backupDir): logger.error("%s does not exist" % backupDir) return False cacheDir = backupConfig['cache_dat_dir'] origDir = os.path.join(cacheDir, "CACHE.DAT") backupCacheDataByGitHash(self._instance, origDir, backupDir, mRepo, mRepoBranch, self._useSudo) startCache(self._instance, self._useSudo) if not isContinuous: break return True if __name__ == '__main__': initConsoleLogging() parserDescr = 'Incremental install Patch, extract M Comp and commit' parser = argparse.ArgumentParser(description=parserDescr) parser.add_argument('configFile', help='Configuration file in JSON format') result = parser.parse_args() runTest = PatchIncrInstallExtractCommit(result.configFile) runTest.run()
def main(): initConsoleLogging() # testing the PatchFileBySha1 logger.info(sys.argv) PatchFileBySha1(sys.argv[1], sys.argv[2], sys.argv[3])
def main(): initConsoleLogging() pass
def testGetPersonNameByDuz(): testClient = createTestClient() initConsoleLogging() with testClient: result = getPersonNameByDuz(1, testClient) print ("Name is [%s]" % result)
def main(): import logging initConsoleLogging(logging.INFO) populate(sys.stdin)
def main(): initConsoleLogging() test_importDir()
def testGetPersonNameByDuz(): testClient = createTestClient() initConsoleLogging() with testClient: result = getPersonNameByDuz(1, testClient) print("Name is [%s]" % result)
def setUp(self): logger.setLevel(logging.ERROR) self.handler = initConsoleLogging(logging.ERROR)