]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-12259] Set packager to module top-level (Fedora only)
authorTravis Rhoden <trhoden@redhat.com>
Wed, 15 Jul 2015 21:12:21 +0000 (21:12 +0000)
committerTravis Rhoden <trhoden@redhat.com>
Thu, 16 Jul 2015 01:30:36 +0000 (01:30 +0000)
Put the logic of selecting the appropriate packager into the hosts.get(),
that way the packager is available to all module methods (like install()
and uninstall()) without having to figure it out each time.

Signed-off-by: Travis Rhoden <trhoden@redhat.com>
ceph_deploy/hosts/__init__.py
ceph_deploy/hosts/fedora/__init__.py
ceph_deploy/hosts/fedora/install.py

index 7699a1c277b70025217394a2cc8efb13acf1e8dd..b9971d2fd9de2be773bc5e6a4442e0f8f2a946e8 100644 (file)
@@ -69,6 +69,8 @@ def get(hostname,
     module.conn = conn
     module.machine_type = machine_type
     module.init = module.choose_init()
+    if module.normalized_name in ['fedora']:
+        module.packager = module.get_packager(module)
     return module
 
 
index bdb84051f036c20cede3ee14e45c20b73af7d399..f42d60a51a1a13572e73b413b12cfeb20e77572d 100644 (file)
@@ -3,6 +3,7 @@ from ceph_deploy.hosts.centos import pkg  # noqa
 from ceph_deploy.hosts.centos.install import repo_install  # noqa
 from install import install, mirror_install  # noqa
 from uninstall import uninstall  # noqa
+from ceph_deploy.util import pkg_managers
 
 # Allow to set some information about this distro
 #
@@ -18,3 +19,10 @@ def choose_init():
     Returns the name of a init system (upstart, sysvinit ...).
     """
     return 'sysvinit'
+
+
+def get_packager(module):
+    if module.normalized_release.int_major >= 22:
+        return pkg_managers.DNF(module)
+    else:
+        return pkg_managers.Yum(module)
index 6ec4fed1ca21358687b326a5dac2d9e95b0d35d9..ff2a06fa4e89915ff014615e83dd33aadd67c8bd 100644 (file)
@@ -1,7 +1,6 @@
 from ceph_deploy.lib import remoto
 from ceph_deploy.hosts.centos.install import repo_install, mirror_install  # noqa
 from ceph_deploy.util.paths import gpg
-from ceph_deploy.util import pkg_managers
 
 
 def install(distro, version_kind, version, adjust_repos, **kw):
@@ -11,18 +10,13 @@ def install(distro, version_kind, version, adjust_repos, **kw):
     release = distro.release
     machine = distro.machine_type
 
-    if distro.normalized_release.int_major >= 22:
-        packager = pkg_managers.DNF(distro)
-    else:
-        packager = pkg_managers.Yum(distro)
-
     if version_kind in ['stable', 'testing']:
         key = 'release'
     else:
         key = 'autobuild'
 
     if adjust_repos:
-        packager.install_priorities_plugin()
+        distro.packager.install_priorities_plugin()
         # haven't been able to determine necessity of check_obsoletes with DNF
         distro.conn.remote_module.enable_yum_priority_obsoletes()
         logger.warning('check_obsoletes has been enabled for Yum priorities plugin')
@@ -81,7 +75,7 @@ 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')
 
-    packager.install(
+    distro.packager.install(
         [
             'ceph',
             'ceph-radosgw'