Also fixed a small issue when exporirting benchmarks.
---
src/secstate/main.py | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index dcad413..4816cc6 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -396,10 +396,14 @@ class Secstate:
self.log.error("No benchmark '%(id)s' has been imported" %
{'id':benchmark_id})
return False
+ if os.path.split(self.content[benchmark_id])[0] ==
self.config.get('secstate', 'oval_dir'):
+ shutil.copy(self.content[benchmark_id], new_file)
+ return True
+
benchmark_file = None
archive = zipfile.ZipFile(new_file, 'w')
if original:
- benchmark_file = os.path.join(self.benchmark_dir, benchmark_id,
self.content[benchmark_id])
+ benchmark_file = self.content[benchmark_id]
else:
benchmark_file = tempfile.mktemp()
(benchmark, oval) = self.import_content(benchmark_id)
@@ -408,8 +412,7 @@ class Secstate:
return False
oscap.xccdf_benchmark_free(benchmark)
oscap.oval_definition_model_free(oval)
-
- archive.write(benchmark_file, self.content[benchmark_id])
+ archive.write(benchmark_file, os.path.basename(self.content[benchmark_id]))
bench_dir = os.path.join(self.benchmark_dir, benchmark_id)
for content in os.listdir(bench_dir):
file_type = mimetypes.guess_type(os.path.join(bench_dir, content))
--
1.7.1.1
Show replies by date