Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clustercheck #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update clustercheck #23

wants to merge 1 commit into from

Conversation

Newbeeee
Copy link

syntax error

syntax error
@Cougar
Copy link

Cougar commented Mar 1, 2019

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

if [[ -n "$MYSQL_PASSWORD" ]]; then
EXTRA_ARGS="$EXTRA_ARGS --password=${MYSQL_PASSWORD}"
fi
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

if [[ -n "$MYSQL_USERNAME" ]]; then
EXTRA_ARGS="$EXTRA_ARGS --user=${MYSQL_USERNAME}"
fi
if [[ -n "$MYSQL_PASSWORD" ]]; then
EXTRA_ARGS="$EXTRA_ARGS --password=${MYSQL_PASSWORD}"
fi
is pointless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants