Remove corosync.conf if it's a dir from remote.

During the upgrade from Queens there can be some wrong config
remainings. One of them is the existence of /etc/corosync/
corosync.conf as a directory. This will cause pacemaker to fail
when the node is upgrade to Train, failing with:
Error:Unable to read /etc/corosync/corosync.conf: Is a directory.

This patch checks during the upgrade if the file exists and it is
a directory. In that case, it will get removed.

Change-Id: I26f9fea0a0495e5e976a56a50c70a15e47d14400
Closes-Bug: #1905033
Resolves: rhbz#1899935
This commit is contained in:
Jose Luis Franco Arza 2020-11-20 14:24:41 +01:00
parent af90cef667
commit d325392623
1 changed files with 17 additions and 0 deletions

View File

@ -46,3 +46,20 @@ outputs:
tripleo::instanceha: {get_param: EnableInstanceHA}
step_config: |
include ::tripleo::profile::pacemaker::compute_instanceha
upgrade_tasks:
- name: Ensure /etc/corosync/corosync.conf is not present as directory
when:
- step|int == 1
block:
- name: Check /etc/corosync/corosync.conf
stat:
path: /etc/corosync/corosync.conf
register: corosync_conf
- name: Remove corosync.conf if it is a directory
file:
path: /etc/corosync/corosync.conf
state: absent
when:
- corosync_conf.stat.isdir is defined
- corosync_conf.stat.isdir|bool