From: Travis Rhoden Date: Wed, 15 Jul 2015 21:12:21 +0000 (+0000) Subject: [RM-12259] Set packager to module top-level (Fedora only) X-Git-Tag: v1.5.26~3^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7716c09afd8c6b9d5033a5c1bfae58d3c663d715;p=ceph-deploy.git [RM-12259] Set packager to module top-level (Fedora only) 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 --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 7699a1c..b9971d2 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -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 diff --git a/ceph_deploy/hosts/fedora/__init__.py b/ceph_deploy/hosts/fedora/__init__.py index bdb8405..f42d60a 100644 --- a/ceph_deploy/hosts/fedora/__init__.py +++ b/ceph_deploy/hosts/fedora/__init__.py @@ -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) diff --git a/ceph_deploy/hosts/fedora/install.py b/ceph_deploy/hosts/fedora/install.py index 6ec4fed..ff2a06f 100644 --- a/ceph_deploy/hosts/fedora/install.py +++ b/ceph_deploy/hosts/fedora/install.py @@ -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'