]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
ensure priorities for custom repos as well 246/head
authorAlfredo Deza <alfredo.deza@inktank.com>
Fri, 3 Oct 2014 16:45:07 +0000 (12:45 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Fri, 3 Oct 2014 16:45:07 +0000 (12:45 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/centos/install.py

index af0b395293ac3030fd3305845b6e806c10233c69..4f11c35db3a797c7fa185b2c45374ec8a60418c1 100644 (file)
@@ -143,18 +143,24 @@ 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.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, 'ceph')
 
 
 def repo_install(distro, reponame, baseurl, gpgkey, **kw):
+    logger = distro.conn.logger
     # Get some defaults
-    name = kw.get('name', '%s repo' % reponame)
-    enabled = kw.get('enabled', 1)
-    gpgcheck = kw.get('gpgcheck', 1)
+    name = kw.pop('name', '%s repo' % reponame)
+    enabled = kw.pop('enabled', 1)
+    gpgcheck = kw.pop('gpgcheck', 1)
     install_ceph = kw.pop('install_ceph', False)
-    proxy = kw.get('proxy')
+    proxy = kw.pop('proxy', '') # will get ignored if empty
     _type = 'repo-md'
     baseurl = baseurl.strip('/')  # Remove trailing slashes
 
@@ -179,6 +185,7 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
         _type=_type,
         gpgkey=gpgkey,
         proxy=proxy,
+        **kw
     )
 
     distro.conn.remote_module.write_yum_repo(
@@ -186,6 +193,21 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
         "%s.repo" % reponame
     )
 
+    repo_path = '/etc/yum.repos.d/{reponame}.repo'.format(reponame=reponame)
+
+    # set the right priority
+    if kw.get('priority'):
+        install_yum_priorities(distro)
+        logger.warning(
+            'ensuring that {repo_path} contains a high priority'.format(
+                repo_path=repo_path)
+        )
+
+        distro.conn.remote_module.set_repo_priority([reponame], repo_path)
+        logger.warning('altered {reponame}.repo priorities to contain: priority=1'.format(
+            reponame=reponame)
+        )
+
     # Some custom repos do not need to install ceph
     if install_ceph:
         pkg_managers.yum(distro.conn, 'ceph')