Bug 2026725

Summary: booth: pcs should check that '/etc/booth' exists
Product: Red Hat Enterprise Linux 9 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: low    
Version: 9.0CC: cluster-maint, cluster-qe, idevat, mlisik, mmazoure, mpospisi, nhostako, omular, svalasti, tojeline
Target Milestone: rcKeywords: Triaged
Target Release: 9.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.11.3-3.el9 Doc Type: Bug Fix
Doc Text:
Cause: User tries to setup booth when booth is not installed. Consequence: Pcs complains about missing booth config file. That is misleading, as the command is supposed to create the booth config file. Fix: Print an error message saying booth config directory is missing and asking the user to make sure booth is installed. Result: The error message clearly says what's wrong and provides recommended course of action.
Story Points: ---
Clone Of: 1791670 Environment:
Last Closed: 2022-11-15 09:48:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1791670    

Description Tomas Jelinek 2021-11-25 15:54:53 UTC
+++ This bug was initially created as a clone of Bug #1791670 +++

Description of problem:
If /etc/booth does not exist, the user get a slightly misleading error message:

# pcs booth setup sites 127.0.0.1 127.0.0.2 127.0.0.3
Error: Unable to write Booth key '/etc/booth/booth.key': No such file or directory: '/etc/booth/booth.key'
Error: Errors have occurred, therefore pcs is unable to continue

It would be better to get something like this:
Configuration directory for booth, /etc/booth, is missing. Is booth installed?


Version-Release number of selected component (if applicable):
pcs-0.10.4-3.el8


How reproducible:
always, easily


Steps to Reproduce:
1. make sure /etc/booth does not exist
2. run 'pcs booth setup' or 'pcs booth pull'


Actual results:
Error: Unable to write Booth key '/etc/booth/booth.key': No such file or directory: '/etc/booth/booth.key'


Expected results:
Error: Configuration directory for booth, /etc/booth, is missing. Is booth installed?


Additional info:
reported upstream https://github.com/ClusterLabs/pcs/issues/225

--- Additional comment from Tomas Jelinek on 2020-01-16 12:04:03 CET ---

The error message comes form a system call for opening a file. To get this resolved, pcs would have to check for existence of /etc/booth specifically before it tries to write files in there.

Comment 1 Tomas Jelinek 2021-11-26 09:17:29 UTC
This has been fixed upstream by community.

Upstream patch: https://github.com/ClusterLabs/pcs/commit/bc4e287d3a48a3215cc86e7e0cc8a09442b22ef9

Test:
[root@rh90-node1:~]# ls /etc/booth
ls: cannot access '/etc/booth': No such file or directory
[root@rh90-node1:~]# pcs booth setup sites 127.0.0.1 127.0.0.2 127.0.0.3
Error: Configuration directory for booth '/etc/booth' is missing. Is booth installed?
Error: Errors have occurred, therefore pcs is unable to continue
[root@rh90-node1:~]# pcs booth pull rh90-node2
Fetching booth config from node 'rh90-node2'...
Error: Configuration directory for booth '/etc/booth' is missing. Is booth installed?
Error: Errors have occurred, therefore pcs is unable to continue

Comment 3 Miroslav Lisik 2022-05-19 17:18:51 UTC
DevTestResults:

[root@r91-1 ~]# rpm -q pcs
pcs-0.11.2-1.el9.x86_64

### booth setup sites

[root@r91-1 ~]# rpm -q booth
package booth is not installed
[root@r91-1 ~]# test -d /etc/booth; echo $?
1

[root@r91-1 ~]# pcs booth setup sites 127.0.0.1 127.0.0.2 127.0.0.3
Error: Configuration directory for booth '/etc/booth' is missing. Is booth installed?
Error: Errors have occurred, therefore pcs is unable to continue

### booth pull

First, create booth config using command 'pcs booth setup sites' on the second node.

[root@r91-2 ~]# rpm -qa | grep booth
booth-core-1.0-251.2.bfb2f92.git.el9.x86_64
booth-site-1.0-251.2.bfb2f92.git.el9.noarch
booth-1.0-251.2.bfb2f92.git.el9.x86_64
[root@r91-2 ~]# ls -l /etc/booth
total 0

root@r91-2 ~]# pcs booth setup sites 127.0.0.1 127.0.0.2 127.0.0.3
[root@r91-2 ~]# echo $?
0
[root@r91-2 ~]# ls -l /etc/booth
total 8
-rw-r--r--. 1 root      root     83 May 17 17:28 booth.conf
-rw-------. 1 hacluster haclient 64 May 17 17:28 booth.key
[root@r91-2 ~]# pcs booth config
authfile = /etc/booth/booth.key
site = 127.0.0.1
site = 127.0.0.2
site = 127.0.0.3

Try to pull booth config from the second node on the first node where /etc/booth directory is missing

[root@r91-1 ~]# pcs booth pull r91-2
Fetching booth config from node 'r91-2'...
Error: Configuration directory for booth '/etc/booth' is missing. Is booth installed?
Error: Errors have occurred, therefore pcs is unable to continue

Comment 10 Tomas Jelinek 2022-07-19 11:14:44 UTC
Additional patch to fix the error message in 'pcs booth sync': https://github.com/ClusterLabs/pcs/commit/0848ff3798269c6e361982ec349d308af5acc64e

Comment 12 Miroslav Lisik 2022-07-29 09:01:46 UTC
DevTestResults:

[root@r91-1 ~]# rpm -qa pcs booth*
booth-core-1.0-251.2.bfb2f92.git.el9.x86_64
booth-arbitrator-1.0-251.2.bfb2f92.git.el9.noarch
booth-site-1.0-251.2.bfb2f92.git.el9.noarch
booth-1.0-251.2.bfb2f92.git.el9.x86_64
pcs-0.11.3-3.el9.x86_64

[root@r91-1 ~]# test -d /etc/booth;  echo $?
0

[root@r91-1 ~]# pcs booth setup sites 127.0.0.{1..3}
[root@r91-1 ~]# pcs booth config
authfile = /etc/booth/booth.key
site = 127.0.0.1
site = 127.0.0.2
site = 127.0.0.3


[root@r91-2 ~]# test -d /etc/booth;  echo $?
1

[root@r91-1 ~]# pcs booth sync
Sending booth configuration to cluster nodes...
r91-1: Booth config saved
Error: r91-2: Unable to save booth configuration: Configuration directory for booth '/etc/booth' is missing. Is booth installed?, use --skip-offline to override
Error: Errors have occurred, therefore pcs is unable to continue

Comment 17 errata-xmlrpc 2022-11-15 09:48:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: pcs security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7935