The audit function requires a profile to be present, even if it is just
an empty profile. This commit adds an empty "Custom" profile on import
if there are no existing profiles in the benchmark.
---
src/secstate/main.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index edca0f1..730258a 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -241,6 +241,12 @@ class Secstate:
shutil.rmtree(bench_dir)
return (None, None)
+ profiles = oscap.xccdf_benchmark_get_profiles(benchmark)
+ if not oscap.xccdf_profile_iterator_has_more(profiles):
+ profile = oscap.xccdf_profile_new()
+ oscap.xccdf_profile_set_id(profile, "Custom")
+ oscap.xccdf_benchmark_add_profile(benchmark, profile)
+
if store_path != None:
id = get_benchmark_id(benchmark_file)
directory = os.path.join(bench_dir, id)
--
1.7.1.1
Show replies by date