Fixes bug #7948
---
src/secstate/main.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index 01405dd..d138114 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -282,6 +282,11 @@ class Secstate:
puppet_files = map(lambda x:
os.path.join(self.config.get('secstate', 'puppet_dir'), x), puppet_files)
else:
puppet_files = map(lambda x:
os.path.join(os.path.dirname(benchmark_file), x), puppet_files)
+ for pup in puppet_files:
+ if not os.path.isfile(pup):
+ self.log.error("Error loading associated puppet content:
'%(file)s'" % {'file':pup})
+ return False
+
benchmark.__dict__['puppet'] = puppet_files
benchmark.config.set(benchmark.id, 'puppet',
json.dumps(list(puppet_files)))
@@ -329,7 +334,7 @@ class Secstate:
return benchmark
- def import_zipped_content(self, zip, type, store_path, puppet, changes=False,
active_profile=NONE_PROFILE):
+ def import_zipped_content(self, zip, type, store_path, changes=False,
active_profile=NONE_PROFILE):
"""
Function: Validate and copy content from zipped file to repository
Input: Zipped file contating content and bool whether it contains puppet
content
@@ -399,7 +404,7 @@ class Secstate:
return benchmark
- def import_content(self, content, puppet=False, changes=True, save=False,
active_profile=NONE_PROFILE):
+ def import_content(self, content, changes=True, save=False,
active_profile=NONE_PROFILE):
"""
Function: Validates XCCDF/OVAL content and optionally saves it to the data
store
Input: File containing content
@@ -419,7 +424,7 @@ class Secstate:
return None
if self.content.has_key(content):
- return self.import_content(self.content[content], puppet, changes,
active_profile=active_profile)
+ return self.import_content(self.content[content], changes,
active_profile=active_profile)
if save:
store_path = self.config.get('secstate', 'benchmark_dir')
@@ -444,7 +449,7 @@ class Secstate:
return self.import_benchmark(content, store_path=store_path,
oval_path=os.path.dirname(content), changes=changes, active_profile=active_profile)
else:
- return self.import_zipped_content(content, file_type, store_path=store_path,
puppet=puppet, changes=changes, active_profile=active_profile)
+ return self.import_zipped_content(content, file_type, store_path=store_path,
changes=changes, active_profile=active_profile)
def export(self, benchmark_id, new_file, original=False):
if not self.content.has_key(benchmark_id):
--
1.7.2.2