diff options
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rwxr-xr-x | cloudinit/distros/__init__.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index d5becd12..99e60e7a 100755 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -102,11 +102,8 @@ class Distro(object): self._apply_hostname(writeable_hostname) def uses_systemd(self): - try: - res = os.lstat('/run/systemd/system') - return stat.S_ISDIR(res.st_mode) - except Exception: - return False + """Wrapper to report whether this distro uses systemd or sysvinit.""" + return uses_systemd() @abc.abstractmethod def package_command(self, cmd, args=None, pkgs=None): @@ -761,4 +758,13 @@ def set_etc_timezone(tz, tz_file=None, tz_conf="/etc/timezone", util.copy(tz_file, tz_local) return + +def uses_systemd(): + try: + res = os.lstat('/run/systemd/system') + return stat.S_ISDIR(res.st_mode) + except Exception: + return False + + # vi: ts=4 expandtab |