Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / ceph-detect-init / ceph_detect_init / debian / __init__.py
1 import os
2 import subprocess
3
4 distro = None
5 release = None
6 codename = None
7
8
9 def choose_init():
10     """Select a init system
11
12     Returns the name of a init system (upstart, sysvinit ...).
13     """
14     # yes, this is heuristics
15     if os.path.isdir('/run/systemd/system'):
16         return 'systemd'
17     if not subprocess.call('. /lib/lsb/init-functions ; init_is_upstart',
18                            shell=True):
19         return 'upstart'
20     if os.path.isfile('/sbin/init') and not os.path.islink('/sbin/init'):
21         return 'sysvinit'