Also fixed several other return codes for other sub-commands.
Fixes bug #7615
---
src/bin/secstate | 16 ++++++++--------
src/secstate/main.py | 3 +++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/bin/secstate b/src/bin/secstate
index b4c484d..2962ad4 100644
--- a/src/bin/secstate
+++ b/src/bin/secstate
@@ -87,28 +87,28 @@ def main():
return remove_content(sys.argv[arg_num:])
elif subcommand == 'select':
- select(sys.argv[arg_num:], True)
+ return select(sys.argv[arg_num:], True)
elif subcommand == 'deselect':
- select(sys.argv[arg_num:], False)
+ return select(sys.argv[arg_num:], False)
elif subcommand == 'audit':
- audit(sys.argv[arg_num:])
+ return audit(sys.argv[arg_num:])
elif subcommand == 'search':
- search(sys.argv[arg_num:])
+ return search(sys.argv[arg_num:])
elif subcommand == 'list':
- list_content(sys.argv[arg_num:])
+ return list_content(sys.argv[arg_num:])
elif subcommand == 'show':
- show(sys.argv[arg_num:])
+ return show(sys.argv[arg_num:])
elif subcommand == 'remediate':
- remediate(sys.argv[arg_num:])
+ return remediate(sys.argv[arg_num:])
elif subcommand == 'save':
- save_profile(sys.argv[arg_num:])
+ return save_profile(sys.argv[arg_num:])
else:
sys.stderr.write("Uknown subcommand: %(command)s" %
{'command':subcommand})
diff --git a/src/secstate/main.py b/src/secstate/main.py
index 9a77b16..712878b 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -752,6 +752,9 @@ class Secstate:
return True
+ self.log.error("Item '%(id)s' could not be found in the imported
content" % {'id':item_id})
+ return False
+
def sublist(self, content, arg, recurse, show_all, tabs=0):
tabstr = "\t" * tabs
selected = ""
--
1.7.2.1
Show replies by date
Forgot to change the return code values for list and remediate.
---
src/secstate/main.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/secstate/main.py b/src/secstate/main.py
index 30d376e..edc9d73 100644
--- a/src/secstate/main.py
+++ b/src/secstate/main.py
@@ -818,9 +818,14 @@ class Secstate:
for sub in item.content:
self.sublist(content, sub.id, recurse, show_all, tabs+1)
+ return True
+
def list_content(self, arg=None, recurse=False, show_all=False):
ret = False
+ if self.content == {}:
+ return True
+
for key in self.content:
content = self.import_content(key)
if content == None:
@@ -833,7 +838,6 @@ class Secstate:
else:
if not self.content.has_key(arg):
ret = self.sublist(content, arg, recurse, show_all)
-
return ret
def get_passed_result_ids(self, xccdf_results):
@@ -900,4 +904,6 @@ class Secstate:
puppet_args.append('--verbose')
subprocess.call(puppet_args)
os.unlink(fname)
+
+ return True
--
1.7.2.2