]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Add support for ALT Linux 472/head
authorAlexey Shabalin <shaba@altlinux.org>
Thu, 3 May 2018 17:32:48 +0000 (20:32 +0300)
committerAlexey Shabalin <shaba@altlinux.org>
Thu, 3 May 2018 17:32:48 +0000 (20:32 +0300)
Signed-off-by: Alexey Shabalin <shaba@altlinux.org>
ceph_deploy/hosts/__init__.py
ceph_deploy/hosts/alt/__init__.py [new file with mode: 0644]
ceph_deploy/hosts/alt/install.py [new file with mode: 0644]
ceph_deploy/hosts/alt/mon/__init__.py [new file with mode: 0644]
ceph_deploy/hosts/alt/uninstall.py [new file with mode: 0644]
ceph_deploy/util/pkg_managers.py

index 1df4f5a54ba0b0b18f6d467d2a13feb9ec10509b..6bb52090a50b68f928fbc9c61a51aa2bfe018758 100644 (file)
@@ -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 (file)
index 0000000..a4e53f3
--- /dev/null
@@ -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 (file)
index 0000000..e795b1b
--- /dev/null
@@ -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 (file)
index 0000000..f266fb0
--- /dev/null
@@ -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 (file)
index 0000000..00c808a
--- /dev/null
@@ -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)
index afd08429b640778c05f56a3dc9ad344e9ad912ae..feb167f39606a58725af0232372db9e0a03e757a 100644 (file)
@@ -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)