diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-04 12:33:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-04 12:33:35 +0000 |
| commit | b4d72616c19d7b079f3225a3f57fe49e5df642f4 (patch) | |
| tree | 7332d47c654176d11da14eef6682e4b1e9fc1f0d /nova/api | |
| parent | 668e8e943d112f7f67e228c43b6b24b544df3ced (diff) | |
| parent | ce9867b3facc90defcc17ce3399d410fbaba95d3 (diff) | |
| download | nova-b4d72616c19d7b079f3225a3f57fe49e5df642f4.tar.gz nova-b4d72616c19d7b079f3225a3f57fe49e5df642f4.tar.xz nova-b4d72616c19d7b079f3225a3f57fe49e5df642f4.zip | |
Merge "Add html reports to report action in coverage extension."
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/coverage_ext.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index a56e9d211..7ad549d4c 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -82,7 +82,6 @@ class CoverageController(object): "cert": self.cert_api.get_backdoor_port, } ports = [] - temp = {} #TODO(mtreinish): Figure out how to bind the backdoor socket to 0.0.0.0 # Currently this will only work if the host is resolved as loopback on # the same host as api-server @@ -121,7 +120,7 @@ class CoverageController(object): def _start_coverage(self, req, body): '''Begin recording coverage information.''' - LOG.debug("Coverage begin") + LOG.debug(_("Coverage begin")) body = body['start'] self.combine = False if 'combine' in body.keys(): @@ -155,8 +154,9 @@ class CoverageController(object): for service in self.services: self._stop_coverage_telnet(service['telnet']) if self._check_coverage(): - msg = ("Coverage not running") + msg = _("Coverage not running") raise exc.HTTPNotFound(explanation=msg) + return {'path': self.data_path} def _report_coverage_telnet(self, tn, path, xml=False): if xml: @@ -176,26 +176,34 @@ class CoverageController(object): def _report_coverage(self, req, body): self._stop_coverage(req) xml = False + html = False path = None body = body['report'] if 'file' in body.keys(): path = body['file'] if path != os.path.basename(path): - msg = ("Invalid path") + msg = _("Invalid path") raise exc.HTTPBadRequest(explanation=msg) path = os.path.join(self.data_path, path) else: - msg = ("No path given for report file") + msg = _("No path given for report file") raise exc.HTTPBadRequest(explanation=msg) if 'xml' in body.keys(): xml = body['xml'] + elif 'html' in body.keys(): + if not self.combine: + msg = _("You can't use html reports without combining") + raise exc.HTTPBadRequest(explanation=msg) + html = body['html'] if self.combine: self.coverInst.combine() if xml: self.coverInst.xml_report(outfile=path) + elif html: + self.coverInst.html_report(directory=path) else: output = open(path, 'w') self.coverInst.report(file=output) |
