]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-12439] centos: use Yum Class package manager
authorTravis Rhoden <trhoden@redhat.com>
Thu, 30 Jul 2015 16:54:52 +0000 (09:54 -0700)
committerTravis Rhoden <trhoden@redhat.com>
Mon, 3 Aug 2015 22:54:41 +0000 (15:54 -0700)
Refs: #12439

ceph_deploy/hosts/__init__.py
ceph_deploy/hosts/centos/__init__.py
ceph_deploy/hosts/centos/install.py
ceph_deploy/hosts/centos/uninstall.py

index b9971d2fd9de2be773bc5e6a4442e0f8f2a946e8..bc73c25d11220bec871556f962c338f6974baa33 100644 (file)
@@ -69,7 +69,7 @@ def get(hostname,
     module.conn = conn
     module.machine_type = machine_type
     module.init = module.choose_init()
-    if module.normalized_name in ['fedora']:
+    if module.normalized_name in ['fedora', 'centos']:
         module.packager = module.get_packager(module)
     return module
 
index 9ac46833860600b50028a6afbe46f1d8885a5d68..b36d87d17e7bffe970f92d7480caf84f8d00a161 100644 (file)
@@ -2,6 +2,7 @@ import mon  # noqa
 import pkg  # noqa
 from install import install, mirror_install, repo_install, repository_url_part, rpm_dist  # noqa
 from uninstall import uninstall  # noqa
+from ceph_deploy.util import pkg_managers
 
 # Allow to set some information about this distro
 #
@@ -10,6 +11,7 @@ distro = None
 release = None
 codename = None
 
+
 def choose_init():    
     """
     Select a init system
@@ -17,3 +19,7 @@ def choose_init():
     Returns the name of a init system (upstart, sysvinit ...).
     """
     return 'sysvinit'
+
+
+def get_packager(module):
+    return pkg_managers.Yum(module)
index 3d0d4731cd0cb777b587b966caa86bc256e1a0c7..8dab18afd08024f33f0a06c73a287cc8ce7b7a14 100644 (file)
@@ -1,6 +1,5 @@
-from ceph_deploy.util import pkg_managers, templates
+from ceph_deploy.util import templates
 from ceph_deploy.lib import remoto
-from ceph_deploy.hosts.util import install_yum_priorities
 from ceph_deploy.hosts.common import map_components
 from ceph_deploy.util.paths import gpg
 
@@ -50,12 +49,12 @@ def install(distro, version_kind, version, adjust_repos, **kw):
     repo_part = repository_url_part(distro)
     dist = rpm_dist(distro)
 
-    pkg_managers.yum_clean(distro.conn)
+    distro.packager.clean()
 
     # Get EPEL installed before we continue:
     if adjust_repos:
-        install_epel(distro)
-        install_yum_priorities(distro)
+        distro.packager.install('epel-release')
+        distro.packager.install_priorities_plugin()
         distro.conn.remote_module.enable_yum_priority_obsoletes()
         logger.warning('check_obsoletes has been enabled for Yum priorities plugin')
     if version_kind in ['stable', 'testing']:
@@ -111,27 +110,8 @@ def install(distro, version_kind, version, adjust_repos, **kw):
         distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source'])
         logger.warning('altered ceph.repo priorities to contain: priority=1')
 
-    if len(packages):
-        cmd = [
-            'yum',
-            '-y',
-            'install',
-        ]
-        cmd.extend(packages)
-        remoto.process.run(
-            distro.conn,
-            cmd,
-        )
-
-
-def install_epel(distro):
-    """
-    CentOS and Scientific need the EPEL repo, otherwise Ceph cannot be
-    installed.
-    """
-    if distro.normalized_name in ['centos', 'scientific']:
-        distro.conn.logger.info('adding EPEL repository')
-        pkg_managers.yum(distro.conn, 'epel-release')
+    if packages:
+        distro.packager.install(packages)
 
 
 def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True, **kw):
@@ -142,7 +122,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True,
     repo_url = repo_url.strip('/')  # Remove trailing slashes
     gpg_url_path = gpg_url.split('file://')[-1]  # Remove file if present
 
-    pkg_managers.yum_clean(distro.conn)
+    distro.packager.clean()
 
     if adjust_repos:
         remoto.process.run(
@@ -161,13 +141,13 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True,
 
         distro.conn.remote_module.write_yum_repo(ceph_repo_content)
         # set the right priority
-        install_yum_priorities(distro)
+        distro.packager.install_priorities_plugin()
         distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source'])
         distro.conn.logger.warning('alter.d ceph.repo priorities to contain: priority=1')
 
 
-    if extra_installs:
-        pkg_managers.yum(distro.conn, packages)
+    if extra_installs and packages:
+        distro.packager.install(packages)
 
 
 def repo_install(distro, reponame, baseurl, gpgkey, **kw):
@@ -185,7 +165,7 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
     _type = 'repo-md'
     baseurl = baseurl.strip('/')  # Remove trailing slashes
 
-    pkg_managers.yum_clean(distro.conn)
+    distro.packager.clean()
 
     if gpgkey:
         remoto.process.run(
@@ -218,7 +198,7 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
 
     # set the right priority
     if kw.get('priority'):
-        install_yum_priorities(distro)
+        distro.packager.install_priorities_plugin()
         logger.warning(
             'ensuring that {repo_path} contains a high priority'.format(
                 repo_path=repo_path)
@@ -230,5 +210,5 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
         )
 
     # Some custom repos do not need to install ceph
-    if install_ceph:
-        pkg_managers.yum(distro.conn, packages)
+    if install_ceph and packages:
+        distro.packager.install(packages)
index 6fdd9c63404b41ef0bf5ad0f09cd071e04b4e546..758c34c8ad941b265872ddd79e8a39c51c86838d 100644 (file)
@@ -1,6 +1,3 @@
-from ceph_deploy.util import pkg_managers
-
-
 def uninstall(distro, purge=False):
     packages = [
         'ceph',
@@ -9,9 +6,5 @@ def uninstall(distro, purge=False):
         'ceph-radosgw',
         ]
 
-    pkg_managers.yum_remove(
-        distro.conn,
-        packages,
-    )
-
-    pkg_managers.yum_clean(distro.conn)
+    distro.packager.remove(packages)
+    distro.packager.clean()