From d194e2c788c080e87a139f06e590edb8098f5707 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 2 Nov 2015 15:23:23 -0500 Subject: [PATCH] check_systemd is not inline but a private fact function now --- lib/ansible/module_utils/facts.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 6d1cc4e725..221ed8bf85 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -575,19 +575,7 @@ class Facts(object): self.facts['service_mgr'] = 'svcs' elif self.facts['system'] == 'Linux': - def check_systemd(module): - # tools must be installed - if module.get_bin_path('systemctl'): - - # this should show if systemd is the boot init system, if check_init faild to mark as systemd - # these mirror systemd's own sd_boot test http://www.freedesktop.org/software/systemd/man/sd_booted.html - for canary in ["/run/systemd/system/", "/dev/.run/systemd/", "/dev/.systemd/"]: - if os.path.exists(canary): - return True - - return False - - if check_systemd(module): + if self._check_systemd(module): self.facts['service_mgr'] = 'systemd' elif module.get_bin_path('initctl') and os.path.exists("/etc/init/"): self.facts['service_mgr'] = 'upstart' @@ -709,6 +697,16 @@ class Facts(object): self.facts['date_time']['tz'] = time.strftime("%Z") self.facts['date_time']['tz_offset'] = time.strftime("%z") + def _check_systemd(self): + # tools must be installed + if module.get_bin_path('systemctl'): + + # this should show if systemd is the boot init system, if check_init faild to mark as systemd + # these mirror systemd's own sd_boot test http://www.freedesktop.org/software/systemd/man/sd_booted.html + for canary in ["/run/systemd/system/", "/dev/.run/systemd/", "/dev/.systemd/"]: + if os.path.exists(canary): + return True + return False # User def get_user_facts(self):