def postMortemSerial(self): serialFilePath = self._saveSerial() try: logbeamfromlocalhost.beam([serialFilePath], under=os.path.join( self._host.name, "postmortem")) finally: shutil.rmtree(os.path.dirname(serialFilePath), ignore_errors=True)
def useLogBeamFromLocal(self): tempDir = tempfile.mkdtemp() try: with open(os.path.join(tempDir, "someLog.txt"), "w") as f: f.write("hello") logbeamfromlocalhost.beam([os.path.join(tempDir, "someLog.txt")]) finally: shutil.rmtree(tempDir, ignore_errors=True) expectedFile = os.path.join(log.config.LOGS_DIRECTORY, "someLog.txt") TS_ASSERT(os.path.exists(expectedFile))
def _postMortemAllocation(self): try: filename, contents = self._allocation.fetchPostMortemPack() except: logging.exception("Unable to get post mortem pack from rackattack provider") return tempDir = tempfile.mkdtemp() try: fullPath = os.path.join(tempDir, filename) with open(fullPath, 'wb') as f: f.write(contents) logbeamfromlocalhost.beam([fullPath]) finally: shutil.rmtree(tempDir, ignore_errors=True) logging.info("Beamed post mortem pack into %(filename)s", dict(filename=filename))
def postMortemSerial(self): serialFilePath = self._saveSerial() try: logbeamfromlocalhost.beam([serialFilePath], under=os.path.join(self._host.name, "postmortem")) finally: shutil.rmtree(os.path.dirname(serialFilePath), ignore_errors=True)