Browse Source

Revisit conflicting package removal

In https://review.openstack.org/534819 we introduced the removal
of conflicting packages from the targeted host, but then we deleted
the list for RedHat in https://review.openstack.org/578844 because
yum kept removing and re-adding the same packages.

In https://review.openstack.org/603205 we solve the issue properly
given that yum is case-insensitive, and the root cause of the repeat
remove/install.

As such, in this patch, we restore the removal of conflicting
packages for RedHat in a different way. Each of the package removal
tasks are moved into the tasks specific to each package manager so
that each can be handled differently.

Change-Id: I70fbfa6eff8796713c6bec32319382273f8281f8
Related-Bug: #1762421
Related-Bug: #1742206
Jesse Pretorius 7 months ago
parent
commit
72f402d3e9

+ 0
- 5
tasks/galera_install.yml View File

@@ -33,11 +33,6 @@
33 33
   when:
34 34
     - ansible_architecture == 'ppc64le'
35 35
 
36
-- name: Remove conflicting distro packages
37
-  package:
38
-    name: "{{ galera_server_mariadb_distro_packages_remove | default([]) }}"
39
-    state: absent
40
-
41 36
 - include_tasks: "galera_install_{{ ansible_pkg_mgr }}.yml"
42 37
 
43 38
 - name: Record galera has been deployed

+ 5
- 0
tasks/galera_install_apt.yml View File

@@ -13,6 +13,11 @@
13 13
 # See the License for the specific language governing permissions and
14 14
 # limitations under the License.
15 15
 
16
+- name: Remove conflicting distro packages
17
+  package:
18
+    name: "{{ galera_server_mariadb_distro_packages_remove | default([]) }}"
19
+    state: absent
20
+
16 21
 - name: If a keyfile is provided, copy the gpg keyfile to the key location
17 22
   copy:
18 23
     src: "{{ item.keyfile }}"

+ 23
- 0
tasks/galera_install_yum.yml View File

@@ -13,6 +13,29 @@
13 13
 # See the License for the specific language governing permissions and
14 14
 # limitations under the License.
15 15
 
16
+# Unfortunately yum is case-insensitive, and RDO has mariadb-* packages,
17
+# while the MariaDB repo has MariaDB-* packages and they conflict.
18
+# To work around this we have to query for any installed RDO/CentOS
19
+# packages using rpm, then remove them. We have to remove them without
20
+# dependencies, otherwise for distro package installation types on shared
21
+# hosts it removes far too many packages.
22
+- name: Remove conflicting packages
23
+  shell: |
24
+    exit_code=0
25
+    for pkg in {{ galera_server_mariadb_distro_packages_remove | join(' ') }}; do
26
+      if rpm --query --quiet ${pkg}; then
27
+        rpm -ev --nodeps ${pkg}
28
+        exit_code=2
29
+      fi
30
+    done
31
+    exit ${exit_code}
32
+  register: _remove_existing_mariadb_packages
33
+  changed_when: _remove_existing_mariadb_packages.rc == 2
34
+  failed_when: _remove_existing_mariadb_packages.rc not in [0, 2]
35
+  args:
36
+    warn: no
37
+    executable: /bin/bash
38
+
16 39
 - name: Update the local file system CRUD
17 40
   file:
18 41
     src: "{{ item.src|default(omit) }}"

+ 5
- 0
tasks/galera_install_zypper.yml View File

@@ -13,6 +13,11 @@
13 13
 # See the License for the specific language governing permissions and
14 14
 # limitations under the License.
15 15
 
16
+- name: Remove conflicting distro packages
17
+  package:
18
+    name: "{{ galera_server_mariadb_distro_packages_remove }}"
19
+    state: absent
20
+
16 21
 - name: Update the local file system CRUD
17 22
   file:
18 23
     src: "{{ item.src|default(omit) }}"

+ 6
- 0
vars/redhat-7.yml View File

@@ -54,6 +54,12 @@ galera_server_mariadb_distro_packages:
54 54
   - rsync
55 55
   - socat
56 56
 
57
+# Conflicting packages with those from the MariaDB repository
58
+galera_server_mariadb_distro_packages_remove:
59
+  - mariadb-common
60
+  - mariadb-config
61
+  - mariadb-server
62
+
57 63
 # The packages to uninstall during an upgrade from a previous version
58 64
 galera_server_upgrade_packages_remove:
59 65
   - MariaDB-Galera-server

Loading…
Cancel
Save