From 04a5edaa33d6a7e64f95c04eceaa82eec12cb237 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Tue, 2 Jun 2015 16:27:57 -0400 Subject: check for systemd using sd_booted() semantics The existing cloud-init code determines if systemd is in use by looking at the distribution name and version. This is prone to error because: - RHEL derivatives other than CentOS (e.g., Scientific Linux) will fail this test, and - Distributions that are not derived from RHEL also use systemd This patch makes cloud-init use the same logic that is used in systemd's sd_booted() method (http://www.freedesktop.org/software/systemd/man/sd_booted.html) LP: #1461201 --- cloudinit/distros/rhel.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'cloudinit/distros/rhel.py') diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index 30c805a6..812e7002 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -111,14 +111,6 @@ class Distro(distros.Distro): rhel_util.update_sysconfig_file(self.network_conf_fn, net_cfg) return dev_names - def uses_systemd(self): - # Fedora 18 and RHEL 7 were the first adopters in their series - (dist, vers) = util.system_info()['dist'][:2] - major = (int)(vers.split('.')[0]) - return ((dist.startswith('Red Hat Enterprise Linux') and major >= 7) - or (dist.startswith('CentOS Linux') and major >= 7) - or (dist.startswith('Fedora') and major >= 18)) - def apply_locale(self, locale, out_fn=None): if self.uses_systemd(): if not out_fn: -- cgit v1.2.3