summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-10 13:52:24 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-10 13:52:32 -0400
commit910c1148691f4c16c2b4ef8d600561ec7054784d (patch)
treeb539d33573ab187355db65a2904bfdaa9a6d331f
parent5ba85c684f52b6fbab7233126c2ba5ea18c51ec0 (diff)
downloadbcfg2-910c1148691f4c16c2b4ef8d600561ec7054784d.tar.gz
bcfg2-910c1148691f4c16c2b4ef8d600561ec7054784d.tar.bz2
bcfg2-910c1148691f4c16c2b4ef8d600561ec7054784d.zip
SELinux: when the policy is upgraded, local changes can be lost (although the fact that there are local changes may be retained). cope with this bug.
-rw-r--r--src/lib/Bcfg2/Client/Tools/SELinux.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/SELinux.py b/src/lib/Bcfg2/Client/Tools/SELinux.py
index 0041ce61a..19d3fa6fc 100644
--- a/src/lib/Bcfg2/Client/Tools/SELinux.py
+++ b/src/lib/Bcfg2/Client/Tools/SELinux.py
@@ -204,7 +204,16 @@ class SELinuxEntryHandler(object):
type, if the records object supports the customized() method
"""
if hasattr(self.records, "customized") and self.custom_re:
- return dict([(k, self.all_records[k]) for k in self.custom_keys])
+ rv = dict()
+ for key in self.custom_keys:
+ if key in self.all_records:
+ rv[key] = self.all_records[key]
+ else:
+ self.logger.warning("SELinux %s %s customized, but no "
+ "record found. This may indicate an "
+ "error in your SELinux policy." %
+ (self.etype, key))
+ return rv
else:
# ValueError is really a pretty dumb exception to raise,
# but that's what the seobject customized() method raises