If the user makes a change to the profile, automatically set the default
profile to "Custom". Also fixed an issue where the benchmark itself
would also be selected or deslected eveytime something was changed.
---
src/bin/secstate | 10 ++++++----
src/secstate/main.py | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/bin/secstate b/src/bin/secstate
index 8cd84f2..c7c5280 100644
--- a/src/bin/secstate
+++ b/src/bin/secstate
@@ -140,11 +140,13 @@ def select(arguments, value):
parser.add_option('-r', '--recurse', action='store_true',
dest='recurse', default=False,
help="Recursively select or deselect rules inside of groups or
benchmarks")
(options, args) = parser.parse_args(arguments)
- #if len(args) == 1:
- #if not sec_instance.select(args[1], None
- for arg in args:
- if (not (sec_instance.select(args[0], arg, value, recurse=options.recurse,
message=options.message))):
+ if len(args) == 1:
+ if not sec_instance.select(args[0], args[0], value):
return -1
+ else:
+ for arg in args[1:]:
+ if (not (sec_instance.select(args[0], arg, value, recurse=options.recurse,
message=options.message))):
+ return -1
def audit(arguments):
parser = OptionParser(usage="secstate audit [options] <benchmark>")
diff --git a/src/secstate/main.py b/src/secstate/main.py
index dcad413..5a8e7b9 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -512,6 +512,7 @@ class Secstate:
self.log.debug("Setting %(id)s to %(val)s" %
{'id':item_id,
'val':selected})
+ bench_cfg.set(benchmark_id, 'profile', 'Custom')
if recurse:
if (item_type == oscap.XCCDF_GROUP) or (item_type ==
oscap.XCCDF_BENCHMARK):
for sub in xccdf_get_items(benchmark, oscap.XCCDF_ITEM,
oscap.xccdf_item_get_content(item)):
--
1.7.1.1
Show replies by date