|
|
c5477d |
From caa5b6a14c6c8175a3f4639df0863271564d16b2 Mon Sep 17 00:00:00 2001
|
|
|
c5477d |
From: Vratislav Podzimek <vpodzime@redhat.com>
|
|
|
c5477d |
Date: Tue, 23 Aug 2016 14:16:15 +0200
|
|
|
c5477d |
Subject: [PATCH 2/3] Beware of the invalid profiles
|
|
|
c5477d |
|
|
|
c5477d |
If a profile we cannot get pre-installation rules for is chosen we need to just
|
|
|
c5477d |
inform the user instead of crashing.
|
|
|
c5477d |
|
|
|
c5477d |
Resolves: rhbz#1365130
|
|
|
c5477d |
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
|
|
|
c5477d |
---
|
|
|
c5477d |
org_fedora_oscap/gui/spokes/oscap.py | 28 ++++++++++++++++------------
|
|
|
c5477d |
1 file changed, 16 insertions(+), 12 deletions(-)
|
|
|
c5477d |
|
|
|
c5477d |
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
|
|
|
c5477d |
index 8f94601..35f7a75 100644
|
|
|
c5477d |
--- a/org_fedora_oscap/gui/spokes/oscap.py
|
|
|
c5477d |
+++ b/org_fedora_oscap/gui/spokes/oscap.py
|
|
|
c5477d |
@@ -581,12 +581,12 @@ class OSCAPSpoke(NormalSpoke):
|
|
|
c5477d |
|
|
|
c5477d |
"""
|
|
|
c5477d |
|
|
|
c5477d |
+ self._message_store.clear()
|
|
|
c5477d |
+
|
|
|
c5477d |
if not self._rule_data:
|
|
|
c5477d |
# RuleData instance not initialized, cannot do anything
|
|
|
c5477d |
return
|
|
|
c5477d |
|
|
|
c5477d |
- self._message_store.clear()
|
|
|
c5477d |
-
|
|
|
c5477d |
messages = self._rule_data.eval_rules(self.data, self._storage,
|
|
|
c5477d |
report_only)
|
|
|
c5477d |
if not messages:
|
|
|
c5477d |
@@ -660,12 +660,6 @@ class OSCAPSpoke(NormalSpoke):
|
|
|
c5477d |
# no profile specified, nothing to do
|
|
|
c5477d |
return False
|
|
|
c5477d |
|
|
|
c5477d |
- itr = self._profiles_store.get_iter_first()
|
|
|
c5477d |
- while itr:
|
|
|
c5477d |
- if self._profiles_store[itr][0] == profile_id:
|
|
|
c5477d |
- self._profiles_store.set_value(itr, 2, True)
|
|
|
c5477d |
- itr = self._profiles_store.iter_next(itr)
|
|
|
c5477d |
-
|
|
|
c5477d |
if self._using_ds:
|
|
|
c5477d |
ds = self._current_ds_id
|
|
|
c5477d |
xccdf = self._current_xccdf_id
|
|
|
c5477d |
@@ -678,10 +672,20 @@ class OSCAPSpoke(NormalSpoke):
|
|
|
c5477d |
xccdf = None
|
|
|
c5477d |
|
|
|
c5477d |
# get pre-install fix rules from the content
|
|
|
c5477d |
- rules = common.get_fix_rules_pre(profile_id,
|
|
|
c5477d |
- self._addon_data.preinst_content_path,
|
|
|
c5477d |
- ds, xccdf,
|
|
|
c5477d |
- self._addon_data.preinst_tailoring_path)
|
|
|
c5477d |
+ try:
|
|
|
c5477d |
+ rules = common.get_fix_rules_pre(profile_id,
|
|
|
c5477d |
+ self._addon_data.preinst_content_path,
|
|
|
c5477d |
+ ds, xccdf,
|
|
|
c5477d |
+ self._addon_data.preinst_tailoring_path)
|
|
|
c5477d |
+ except common.OSCAPaddonError:
|
|
|
c5477d |
+ self._set_error("Failed to get rules for the profile '%s'" % profile_id)
|
|
|
c5477d |
+ return False
|
|
|
c5477d |
+
|
|
|
c5477d |
+ itr = self._profiles_store.get_iter_first()
|
|
|
c5477d |
+ while itr:
|
|
|
c5477d |
+ if self._profiles_store[itr][0] == profile_id:
|
|
|
c5477d |
+ self._profiles_store.set_value(itr, 2, True)
|
|
|
c5477d |
+ itr = self._profiles_store.iter_next(itr)
|
|
|
c5477d |
|
|
|
c5477d |
# parse and store rules with a clean RuleData instance
|
|
|
c5477d |
self._rule_data = rule_handling.RuleData()
|
|
|
c5477d |
--
|
|
|
c5477d |
2.7.4
|
|
|
c5477d |
|