From: Travis Rhoden Date: Fri, 31 Jul 2015 22:55:38 +0000 (-0700) Subject: [RM-12439] rhel: use Yum Class package manager X-Git-Tag: v1.5.27~6^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=30959780c447452bf1533c023b1c327430d864a1;p=ceph-deploy.git [RM-12439] rhel: use Yum Class package manager Refs: #12439 Signed-off-by: Travis Rhoden --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index bc73c25..e725882 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -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', 'centos']: + if module.normalized_name in ['fedora', 'centos', 'redhat']: module.packager = module.get_packager(module) return module diff --git a/ceph_deploy/hosts/rhel/__init__.py b/ceph_deploy/hosts/rhel/__init__.py index 13f7b22..c866247 100644 --- a/ceph_deploy/hosts/rhel/__init__.py +++ b/ceph_deploy/hosts/rhel/__init__.py @@ -2,6 +2,7 @@ import mon # noqa import pkg # noqa from install import install, mirror_install, repo_install # noqa from uninstall import uninstall # noqa +from ceph_deploy.util import pkg_managers # Allow to set some information about this distro # @@ -17,3 +18,7 @@ def choose_init(): Returns the name of a init system (upstart, sysvinit ...). """ return 'sysvinit' + + +def get_packager(module): + return pkg_managers.Yum(module) diff --git a/ceph_deploy/hosts/rhel/install.py b/ceph_deploy/hosts/rhel/install.py index 9a44cdd..a8abdd0 100644 --- a/ceph_deploy/hosts/rhel/install.py +++ b/ceph_deploy/hosts/rhel/install.py @@ -1,11 +1,11 @@ -from ceph_deploy.util import pkg_managers, templates +from ceph_deploy.util import templates from ceph_deploy.lib import remoto def install(distro, version_kind, version, adjust_repos, **kw): packages = kw.get('components', []) - pkg_managers.yum_clean(distro.conn) - pkg_managers.yum(distro.conn, packages) + distro.packager.clean() + distro.packager.install(packages) def mirror_install(distro, repo_url, @@ -14,7 +14,7 @@ def mirror_install(distro, repo_url, 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( @@ -33,8 +33,8 @@ def mirror_install(distro, repo_url, distro.conn.remote_module.write_yum_repo(ceph_repo_content) - 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): @@ -51,7 +51,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( @@ -81,5 +81,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) diff --git a/ceph_deploy/hosts/rhel/uninstall.py b/ceph_deploy/hosts/rhel/uninstall.py index daf2cf6..17ae208 100644 --- a/ceph_deploy/hosts/rhel/uninstall.py +++ b/ceph_deploy/hosts/rhel/uninstall.py @@ -1,6 +1,3 @@ -from ceph_deploy.util import pkg_managers - - def uninstall(distro, purge=False): packages = [ 'ceph', @@ -10,9 +7,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()