diff options
Diffstat (limited to 'src/lib/Bcfg2/Client')
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/APT.py | 2 | ||||
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/POSIX/__init__.py | 2 | ||||
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/POSIX/base.py | 6 | ||||
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/Pkgng.py | 2 | ||||
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/Systemd.py | 14 |
5 files changed, 20 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py index abc76ef1c..9b3dded99 100644 --- a/src/lib/Bcfg2/Client/Tools/APT.py +++ b/src/lib/Bcfg2/Client/Tools/APT.py @@ -236,7 +236,7 @@ class APT(Bcfg2.Client.Tools.Tool): self.logger.error("Cannot find correct versions of packages:") self.logger.error(bad_pkgs) if not ipkgs: - return + return dict() if not self.cmd.run(self.pkgcmd % (" ".join(ipkgs))): self.logger.error("APT command failed") self.pkg_cache = apt.cache.Cache() diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py b/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py index c27c7559d..41bff751d 100644 --- a/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py +++ b/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py @@ -14,7 +14,7 @@ from Bcfg2.Client.Tools.POSIX.base import POSIXTool class POSIX(Bcfg2.Client.Tools.Tool): """POSIX File support code.""" - options = Bcfg2.Client.Tools.Tool.options + [ + options = Bcfg2.Client.Tools.Tool.options + POSIXTool.options + [ Bcfg2.Options.PathOption( cf=('paranoid', 'path'), default='/var/cache/bcfg2', dest='paranoid_path', diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/base.py b/src/lib/Bcfg2/Client/Tools/POSIX/base.py index 488920989..89675af02 100644 --- a/src/lib/Bcfg2/Client/Tools/POSIX/base.py +++ b/src/lib/Bcfg2/Client/Tools/POSIX/base.py @@ -303,7 +303,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool): # no context listed return True secontext = selinux.lgetfilecon(path)[1].split(":")[2] - if secontext in Bcfg2.Options.setup.posix_secontext_ignore: + if secontext in Bcfg2.Options.setup.secontext_ignore: return True try: if context == '__default__': @@ -562,8 +562,8 @@ class POSIXTool(Bcfg2.Client.Tools.Tool): except OSError: errors.append("%s has no default SELinux context" % entry.get("name")) - else: - wanted_secontext = entry.get("secontext") + elif entry.get("secontext"): + wanted_secontext = entry.get("secontext").split(":")[2] if (wanted_secontext and attrib['current_secontext'] != wanted_secontext): errors.append("SELinux context for path %s is incorrect. " diff --git a/src/lib/Bcfg2/Client/Tools/Pkgng.py b/src/lib/Bcfg2/Client/Tools/Pkgng.py index eef86a131..025bc59be 100644 --- a/src/lib/Bcfg2/Client/Tools/Pkgng.py +++ b/src/lib/Bcfg2/Client/Tools/Pkgng.py @@ -205,7 +205,7 @@ class Pkgng(Bcfg2.Client.Tools.Tool): self.logger.error("Cannot find correct versions of packages:") self.logger.error(bad_pkgs) if not ipkgs: - return + return dict() if not self.cmd.run(self.pkgcmd % (" ".join(ipkgs))): self.logger.error("pkg command failed") self._load_pkg_cache() diff --git a/src/lib/Bcfg2/Client/Tools/Systemd.py b/src/lib/Bcfg2/Client/Tools/Systemd.py index bfcc69475..5f9208afc 100644 --- a/src/lib/Bcfg2/Client/Tools/Systemd.py +++ b/src/lib/Bcfg2/Client/Tools/Systemd.py @@ -2,6 +2,8 @@ """This is systemd support.""" +import glob +import os import Bcfg2.Client.Tools import Bcfg2.Client.XML @@ -91,3 +93,15 @@ class Systemd(Bcfg2.Client.Tools.SvcTool): return self.cmd.run(cmd).success else: return True + + def FindExtra(self): + """Find Extra Systemd Service entries.""" + specified = [self.get_svc_name(entry) + for entry in self.getSupportedEntries()] + extra = set() + for fname in glob.glob("/etc/systemd/system/*.wants/*"): + name = os.path.basename(fname) + if name not in specified: + extra.add(name) + return [Bcfg2.Client.XML.Element('Service', name=name, type='systemd') + for name in list(extra)] |