Skip to content

Commit

Permalink
tools: ceph-detect-init: handle alt releases in CentOS
Browse files Browse the repository at this point in the history
The release string can be something like "7 (AltArch)"

Signed-off-by: Nathan Cutler <ncutler@suse.com>
  • Loading branch information
smithfarm committed Apr 19, 2018
1 parent b4b63b0 commit d8cb1cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ceph-detect-init/ceph_detect_init/centos/__init__.py
Expand Up @@ -3,11 +3,16 @@
codename = None


# handle release strings like "7 (AltArch)"
def _rh_major_version(v):
return int("".join(itertools.takewhile(str.isdigit, v)))


def choose_init():
"""Select a init system
Returns the name of a init system (upstart, sysvinit ...).
"""
if release and int(release.split('.')[0]) >= 7:
if release and _rh_major_version(release) >= 7:
return 'systemd'
return 'sysvinit'

0 comments on commit d8cb1cc

Please sign in to comment.