percona-clustercheck icon indicating copy to clipboard operation
percona-clustercheck copied to clipboard

Update clustercheck

Open Newbeeee opened this issue 7 years ago • 1 comments

syntax error

Newbeeee avatar Oct 18 '18 07:10 Newbeeee

The problem is only with MYSQL_USERNAME but your fix is wrong here. Your change won't keep empty variable and therefore it is not possible to put username and password in /etc/my.cnf. I didn't find it in bash manual but this is how the MYSQL_PASSWORD works ('!' is not allowed in command line):

>echo "${MYSQL_PASSWORD-clustercheckpassword}"
clustercheckpassword
>export MYSQL_PASSWORD=''; echo "${MYSQL_PASSWORD-clustercheckpassword}"

>export MYSQL_PASSWORD='x'; echo "${MYSQL_PASSWORD-clustercheckpassword}"
x

but

>export MYSQL_PASSWORD=''; echo "${MYSQL_PASSWORD:-clustercheckpassword}"
clustercheckpassword

In second case the https://github.com/olafz/percona-clustercheck/blob/d5da8bed4ead8440dbef33c8959be42e37e881ae/clustercheck#L52-L54 condition doesn't add --password parameter which is intentional. Otherwise it always overrides password in /etc/my.cnf.

The same should be with MYSQL_USERNAME.

With :- syntax it is not possible to have empty variable and https://github.com/olafz/percona-clustercheck/blob/d5da8bed4ead8440dbef33c8959be42e37e881ae/clustercheck#L49-L54 is pointless.

Cougar avatar Mar 01 '19 22:03 Cougar