Fixes bug 7151
---
src/secstate/main.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index c3b84d7..4771b7c 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -109,6 +109,7 @@ class Secstate:
benchmark = oscap.xccdf_benchmark_import(benchmark_file)
if benchmark == None:
self.log.error("Error importing benchmark %(file)s" %
{'file':benchmark_file})
+ shutil.rmtree(bench_dir)
return (None, None)
def_model = oscap.oval_definition_model_new()
@@ -123,6 +124,7 @@ class Secstate:
oscap.oval_definition_model_free(def_model)
oscap.oval_definition_model_free(tmp)
self.log.error('Error combining definition models')
+ shutil.rmtree(bench_dir)
return (None, None)
oscap.oval_definition_model_free(tmp)
@@ -130,6 +132,7 @@ class Secstate:
if not oscap.oval_definition_model_is_valid(def_model):
self.log.error("Definition model is invalid")
oscap.oval_definition_model_free(def_model)
+ shutil.rmtree(bench_dir)
return (None, None)
if store_path != None:
@@ -140,6 +143,7 @@ class Secstate:
db_file = open(self.config.get('secstate',
'benchmark_database'), 'w')
except IOError, e:
self.log.error("Could not update database: %(error)s" %
{'error':e})
+ shutil.rmtree(bench_dir)
return (None, None)
pickle.dump(self.database, db_file)
@@ -151,6 +155,7 @@ class Secstate:
shutil.copy(oval, directory)
except (IOError, OSError), e:
self.log.error("Error importing content: %(error)s" %
{'error':e})
+ shutil.rmtree(bench_dir)
return (None, None)
return (benchmark, def_model)
--
1.7.0.1
Show replies by date
Before we had always assumed that the OVAL was in the current working
directory.
Fixes bug #7152
---
src/secstate/main.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index 4771b7c..f5a4be8 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -97,6 +97,8 @@ class Secstate:
Input: Source File, path to associated OVAL content
Output: A tuple containg validated xccdf_benchmark and
oval_definition_model
"""
+ if oval_path == "":
+ oval_path = os.path.split(benchmark_file)[0]
#Create benchmark dir if it does not already exist
bench_dir = self.benchmark_dir
if not os.path.isdir(bench_dir):
@@ -146,18 +148,18 @@ class Secstate:
shutil.rmtree(bench_dir)
return (None, None)
- pickle.dump(self.database, db_file)
directory = os.path.join(bench_dir, folder)
try:
os.mkdir(directory)
shutil.copy(benchmark_file, directory)
for oval in list(set(oval_files)):
- shutil.copy(oval, directory)
+ shutil.copy(os.path.join(oval_path, oval), directory)
except (IOError, OSError), e:
self.log.error("Error importing content: %(error)s" %
{'error':e})
shutil.rmtree(bench_dir)
return (None, None)
+ pickle.dump(self.database, db_file)
return (benchmark, def_model)
def import_zipped_content(self, zip, type, store_path, puppet):
--
1.7.0.1