]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Set check_obsoletes = 1 in yum's priorities.conf 440/head
authorZack Cerza <zack@redhat.com>
Mon, 16 Feb 2015 20:08:57 +0000 (13:08 -0700)
committerZack Cerza <zack@redhat.com>
Mon, 16 Feb 2015 20:10:06 +0000 (13:10 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/install.py

index 204225f1f1f8265a581907377f5cd3923513569d..d1f85d90ba7899b4725aea2b6b6eb00fa649f44a 100644 (file)
@@ -399,6 +399,29 @@ def _yum_fix_repo_host(remote, project):
     )
 
 
+def _yum_set_check_obsoletes(remote):
+    """
+    Set check_obsoletes = 1 in /etc/yum/pluginconf.d/priorities.conf
+
+    Creates a backup at /etc/yum/pluginconf.d/priorities.conf.orig so we can
+    restore later.
+    """
+    conf_path = '/etc/yum/pluginconf.d/priorities.conf'
+    conf_path_orig = conf_path + '.orig'
+    remote.run(args=['sudo', 'cp', '-af', conf_path, conf_path_orig])
+    remote.run(args=['echo', 'check_obsoletes = 1', run.Raw('|'),
+                     'sudo', 'tee', '-a', conf_path])
+
+
+def _yum_unset_check_obsoletes(remote):
+    """
+    Restore the /etc/yum/pluginconf.d/priorities.conf backup
+    """
+    conf_path = '/etc/yum/pluginconf.d/priorities.conf'
+    conf_path_orig = conf_path + '.orig'
+    remote.run(args=['sudo', 'mv', '-f', conf_path_orig, conf_path])
+
+
 def _update_rpm_package_list_and_install(ctx, remote, rpm, config):
     """
     Installs the ceph-release package for the relevant branch, then installs
@@ -434,6 +457,7 @@ def _update_rpm_package_list_and_install(ctx, remote, rpm, config):
     uri = baseparms['uri']
     _yum_fix_repo_priority(remote, project, uri)
     _yum_fix_repo_host(remote, project)
+    _yum_set_check_obsoletes(remote)
 
     remote.run(
         args=[
@@ -692,6 +716,7 @@ def _remove_sources_list_rpm(remote, proj):
         args=['sudo', 'rm', '-r', '/var/log/{proj}'.format(proj=proj)],
         check_status=False,
     )
+    _yum_unset_check_obsoletes(remote)
 
 
 def remove_sources(ctx, config):