diff options
author | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2013-01-04 11:28:26 -0500 |
---|---|---|
committer | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2013-01-11 16:21:38 -0500 |
commit | 89f91daa49c201ef12717dbd4876639581036bbe (patch) | |
tree | b743ca4e5e83c928e9e3384b70b5e497b35f6a6e | |
parent | 80325d6897e9aadd0287e5e4e3fc3ada03448dac (diff) | |
download | nova-89f91daa49c201ef12717dbd4876639581036bbe.tar.gz nova-89f91daa49c201ef12717dbd4876639581036bbe.tar.xz nova-89f91daa49c201ef12717dbd4876639581036bbe.zip |
Handle directory conflicts with html output.
When calling html_report() if the output path already exists
instead of rewriting the files in the directory html_report
throws OSError: [Errno 17] File exists which leads to a 500
return to the api call. This commit avoids this issue by
checking if the directory exists beforehand and returning a
400 with an error message instead.
Change-Id: I061534c9ce9977692a7fc98187c4797b2ed60ab2
-rw-r--r-- | nova/api/openstack/compute/contrib/coverage_ext.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index 7ad549d4c..e451111a4 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -203,6 +203,9 @@ class CoverageController(object): if xml: self.coverInst.xml_report(outfile=path) elif html: + if os.path.isdir(path): + msg = _("Directory conflict: %s already exists") + raise exc.HTTPBadRequest(explanation=msg) self.coverInst.html_report(directory=path) else: output = open(path, 'w') |