]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
move the yum priority utility to hosts/util
authorAlfredo Deza <alfredo.deza@inktank.com>
Thu, 28 Aug 2014 15:42:44 +0000 (11:42 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Thu, 28 Aug 2014 15:42:44 +0000 (11:42 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/util.py [new file with mode: 0644]

diff --git a/ceph_deploy/hosts/util.py b/ceph_deploy/hosts/util.py
new file mode 100644 (file)
index 0000000..7457c35
--- /dev/null
@@ -0,0 +1,29 @@
+"""
+A utility module that can host utilities that will be used by more than
+one type of distro and not common to all of them
+"""
+
+def install_yum_priorities(distro, _yum=None):
+    """
+    EPEL started packaging Ceph so we need to make sure that the ceph.repo we
+    install has a higher priority than the EPEL repo so that when installing
+    Ceph it will come from the repo file we create.
+
+    The name of the package changed back and forth (!) since CentOS 4:
+
+    From the CentOS wiki::
+
+        Note: This plugin has carried at least two differing names over time.
+        It is named yum-priorities on CentOS-5 but was named
+        yum-plugin-priorities on CentOS-4. CentOS-6 has reverted to
+        yum-plugin-priorities.
+
+    :params _yum: Used for testing, so we can inject a fake yum
+    """
+    yum = _yum or pkg_managers.yum
+    package_name = 'yum-plugin-priorities'
+
+    if distro.normalized_name == 'centos':
+        if distro.release[0] != '6':
+            package_name = 'yum-priorities'
+    yum(distro.conn, package_name)