From: Alexey Shabalin Date: Thu, 3 May 2018 17:32:48 +0000 (+0300) Subject: Add support for ALT Linux X-Git-Tag: v2.1.0~27^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1d79a1e949e111d36451a686c567020ea17822ba;p=ceph-deploy.git Add support for ALT Linux Signed-off-by: Alexey Shabalin --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 1df4f5a..6bb5209 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -7,7 +7,7 @@ on the type of distribution/version we are dealing with. import logging from ceph_deploy import exc from ceph_deploy.util import versions -from ceph_deploy.hosts import debian, centos, fedora, suse, remotes, rhel, arch +from ceph_deploy.hosts import debian, centos, fedora, suse, remotes, rhel, arch, alt from ceph_deploy.connection import get_connection logger = logging.getLogger() @@ -68,7 +68,7 @@ def get(hostname, module.distro = module.normalized_name module.is_el = module.normalized_name in ['redhat', 'centos', 'fedora', 'scientific', 'oracle', 'virtuozzo'] module.is_rpm = module.normalized_name in ['redhat', 'centos', - 'fedora', 'scientific', 'suse', 'oracle', 'virtuozzo'] + 'fedora', 'scientific', 'suse', 'oracle', 'virtuozzo', 'alt'] module.is_deb = module.normalized_name in ['debian', 'ubuntu'] module.is_pkgtarxz = module.normalized_name in ['arch'] module.release = release @@ -99,7 +99,8 @@ def _get_distro(distro, fallback=None, use_rhceph=False): 'fedora': fedora, 'suse': suse, 'virtuozzo': centos, - 'arch': arch + 'arch': arch, + 'alt': alt } if distro == 'redhat' and use_rhceph: @@ -126,6 +127,8 @@ def _normalized_distro_name(distro): return 'virtuozzo' elif distro.startswith('arch'): return 'arch' + elif distro.startswith(('alt', 'altlinux', 'basealt', 'alt linux')): + return 'alt' return distro diff --git a/ceph_deploy/hosts/alt/__init__.py b/ceph_deploy/hosts/alt/__init__.py new file mode 100644 index 0000000..a4e53f3 --- /dev/null +++ b/ceph_deploy/hosts/alt/__init__.py @@ -0,0 +1,30 @@ +from . import mon # noqa +from .install import install # noqa +from .uninstall import uninstall # noqa +from ceph_deploy.util import pkg_managers +from ceph_deploy.util.system import is_systemd + +# Allow to set some information about this distro +# + +distro = None +release = None +codename = None + + +def choose_init(module): + """ + Select a init system + + Returns the name of a init system (systemd, sysvinit ...). + """ + + + if is_systemd(module.conn): + return 'systemd' + + return 'sysvinit' + + +def get_packager(module): + return pkg_managers.AptRpm(module) diff --git a/ceph_deploy/hosts/alt/install.py b/ceph_deploy/hosts/alt/install.py new file mode 100644 index 0000000..e795b1b --- /dev/null +++ b/ceph_deploy/hosts/alt/install.py @@ -0,0 +1,43 @@ +from ceph_deploy.hosts.centos.install import repo_install, mirror_install # noqa +from ceph_deploy.hosts.common import map_components +from ceph_deploy.util.system import enable_service, start_service + + +NON_SPLIT_PACKAGES = [ + 'ceph-osd', + 'ceph-mds', + 'ceph-mon', + 'ceph-mgr', +] + +SYSTEMD_UNITS = [ + 'ceph.target', + 'ceph-mds.target', + 'ceph-mon.target', + 'ceph-mgr.target', + 'ceph-osd.target', +] +SYSTEMD_UNITS_SKIP_START = [ + 'ceph-mgr.target', + 'ceph-mon.target', +] +SYSTEMD_UNITS_SKIP_ENABLE = [ +] + + +def install(distro, version_kind, version, adjust_repos, **kw): + packages = map_components( + NON_SPLIT_PACKAGES, + kw.pop('components', []) + ) + + if packages: + distro.packager.clean() + distro.packager.install(packages) + + # Start and enable services + for unit in SYSTEMD_UNITS: + if unit not in SYSTEMD_UNITS_SKIP_START: + start_service(distro.conn, unit) + if unit not in SYSTEMD_UNITS_SKIP_ENABLE: + enable_service(distro.conn, unit) diff --git a/ceph_deploy/hosts/alt/mon/__init__.py b/ceph_deploy/hosts/alt/mon/__init__.py new file mode 100644 index 0000000..f266fb0 --- /dev/null +++ b/ceph_deploy/hosts/alt/mon/__init__.py @@ -0,0 +1,2 @@ +from ceph_deploy.hosts.common import mon_add as add # noqa +from ceph_deploy.hosts.common import mon_create as create # noqa diff --git a/ceph_deploy/hosts/alt/uninstall.py b/ceph_deploy/hosts/alt/uninstall.py new file mode 100644 index 0000000..00c808a --- /dev/null +++ b/ceph_deploy/hosts/alt/uninstall.py @@ -0,0 +1,11 @@ +def uninstall(distro, purge=False): + packages = [ + 'ceph-common', + 'ceph-base', + 'ceph-radosgw', + 'python-module-cephfs', + 'python-module-rados', + 'python-module-rbd', + 'python-module-rgw', + ] + distro.packager.remove(packages) diff --git a/ceph_deploy/util/pkg_managers.py b/ceph_deploy/util/pkg_managers.py index afd0842..feb167f 100644 --- a/ceph_deploy/util/pkg_managers.py +++ b/ceph_deploy/util/pkg_managers.py @@ -377,3 +377,53 @@ class Pacman(PackageManager): def add_repo_gpg_key(self, url): cmd = ['pacman-key', '-a', url] self._run(cmd) + + +class AptRpm(PackageManager): + """ + Apt-Rpm package management + """ + + executable = [ + 'apt-get', + '-y', + '-q', + '-V', + ] + name = 'apt' + + def install(self, packages, **kw): + if isinstance(packages, str): + packages = [packages] + + extra_flags = kw.pop('extra_install_flags', None) + cmd = self.executable + ['install'] + + if extra_flags: + if isinstance(extra_flags, str): + extra_flags = [extra_flags] + cmd.extend(extra_flags) + cmd.extend(packages) + return self._run(cmd) + + def remove(self, packages, **kw): + if isinstance(packages, str): + packages = [packages] + + + extra_flags = kw.pop('extra_remove_flags', None) + cmd = self.executable + [ + '-y', + 'remove' + ] + if extra_flags: + if isinstance(extra_flags, str): + extra_flags = [extra_flags] + cmd.extend(extra_flags) + + cmd.extend(packages) + return self._run(cmd) + + def clean(self): + cmd = self.executable + ['update'] + return self._run(cmd)