Fix report save path

Fix path in method download_scan_result
for nessus scans.

Change-Id: Id5e822159edc3b1ef02fd7eb2a1c1621740304d1
Closes-Bug:#1489972
This commit is contained in:
Egor Kotko 2015-08-28 19:27:29 +02:00
parent 73ed8d7c84
commit 305740b97c
2 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import json
import os
import urlparse
from devops.helpers.helpers import wait
@ -164,12 +165,14 @@ class NessusClient(object):
interval=10, timeout=600)
return file_id
def download_scan_result(self, scan_id, file_id, scan_type, save_format):
def download_scan_result(
self, scan_id, file_id, scan_type, save_format, file_path):
report = self.get_raw('/scans/{0}/export/{1}/download'
.format(scan_id, file_id))
filename = 'nessus_report_scan_{0}_{1}.{2}'\
.format(scan_id, scan_type, save_format)
logger.info("Saving Nessus scan report: {0}".format(filename))
with open(filename, 'w') as report_file:
file_with_path = os.path.join(file_path, filename)
logger.info("Saving Nessus scan report: {0}".format(file_with_path))
with open(file_with_path, 'w') as report_file:
report_file.write(report)

View File

@ -17,6 +17,7 @@ from devops.helpers.helpers import tcp_ping
from devops.helpers.helpers import wait
import netaddr
from proboscis import test
from settings import LOGS_DIR
from fuelweb_test.helpers import decorators
from fuelweb_test.helpers import nessus
@ -138,7 +139,7 @@ class TestNessus(NeutronTunHaBase):
file_id = nessus_client.export_scan(scan_id, history_id, 'html')
nessus_client.download_scan_result(scan_id, file_id,
'master_cpa', 'html')
'master_cpa', 'html', LOGS_DIR)
self.env.make_snapshot("nessus_fuel_master_cpa")
@ -196,7 +197,7 @@ class TestNessus(NeutronTunHaBase):
file_id = nessus_client.export_scan(scan_id, history_id, 'html')
nessus_client.download_scan_result(scan_id, file_id,
'master_wat', 'html')
'master_wat', 'html', LOGS_DIR)
self.env.make_snapshot("nessus_fuel_master_wat")
@ -258,6 +259,6 @@ class TestNessus(NeutronTunHaBase):
file_id = nessus_client.export_scan(scan_id, history_id, 'html')
nessus_client.download_scan_result(scan_id, file_id,
'controller_cpa', 'html')
'controller_cpa', 'html', LOGS_DIR)
self.env.make_snapshot("nessus_controller_ubuntu_cpa")