Skip to content

Commit

Permalink
OpTestOpenBMC: Download dumps to logdir
Browse files Browse the repository at this point in the history
Download the openbmc dumps to logdir to allow for running
--run testcases.testRestAPI.HostOff.test_obmc_download_dumps
(possibly as an additional component of automation).

Additional issue opened on openbmc:

BMC Capture journal ->
openbmc/phosphor-debug-collector#6

Signed-off-by: Deb McLemore <[email protected]>
  • Loading branch information
debmc committed Dec 13, 2018
1 parent 7d10887 commit 513ccd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OpTestConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def parse_args(self, argv=None):

OpTestLogger.optest_logger_glob.setUpLoggerFile(datetime.utcnow().strftime("%Y%m%d%H%M%S%f")+'.main.log')
OpTestLogger.optest_logger_glob.setUpLoggerDebugFile(datetime.utcnow().strftime("%Y%m%d%H%M%S%f")+'.debug.log')
OpTestLogger.optest_logger_glob.optest_logger.info('TestCase Log files: {}/*{}*'.format(self.output, self.outsuffix))
OpTestLogger.optest_logger_glob.optest_logger.info('TestCase Log files: {}/*'.format(self.output))
OpTestLogger.optest_logger_glob.optest_logger.info('StreamHandler setup {}'.format('quiet' if self.args.quiet else 'normal'))

self.logfile_proc = subprocess.Popen(logcmd,
Expand Down
3 changes: 2 additions & 1 deletion common/OpTestOpenBMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import json
import requests
import cgi
import os

from OpTestSSH import OpTestSSH
from OpTestBMC import OpTestBMC
Expand Down Expand Up @@ -662,7 +663,7 @@ def download_dump(self, dump_id, minutes=BMC_CONST.HTTP_RETRY):
uri = "/download/dump/{}".format(dump_id)
r = self.conf.util_bmc_server.get(uri=uri, stream=True, minutes=minutes)
value, params = cgi.parse_header(r.headers.get('Content-Disposition'))
with open(params.get('filename'), 'wb') as f:
with open(os.path.join(self.conf.logdir, params.get('filename')), 'wb') as f:
f.write(r.content)

def delete_dump(self, dump_id, minutes=BMC_CONST.HTTP_RETRY):
Expand Down

0 comments on commit 513ccd2

Please sign in to comment.