mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Rearrange mysql options so that --defaults-file is always first, and remove default: localhost from pt-ms and pt-stalk, since parse_options.sh deals with defaults + config files for mysql options poorly
This commit is contained in:
@@ -2422,7 +2422,7 @@ main() {
|
|||||||
trap sigtrap HUP INT TERM
|
trap sigtrap HUP INT TERM
|
||||||
|
|
||||||
local MYSQL_ARGS="$(mysql_options)"
|
local MYSQL_ARGS="$(mysql_options)"
|
||||||
EXT_ARGV="$EXT_ARGV $MYSQL_ARGS"
|
EXT_ARGV="$(arrange_mysql_options "$EXT_ARGV $MYSQL_ARGS")"
|
||||||
|
|
||||||
# Check if mysql and mysqldump are there, otherwise bail out early.
|
# Check if mysql and mysqldump are there, otherwise bail out early.
|
||||||
# But don't if they passed in --read-samples, since we don't need
|
# But don't if they passed in --read-samples, since we don't need
|
||||||
@@ -2980,7 +2980,7 @@ pathname.
|
|||||||
|
|
||||||
=item --host
|
=item --host
|
||||||
|
|
||||||
short form: -h; type: string; default: localhost
|
short form: -h; type: string
|
||||||
|
|
||||||
Host to connect to.
|
Host to connect to.
|
||||||
|
|
||||||
|
19
bin/pt-stalk
19
bin/pt-stalk
@@ -486,6 +486,21 @@ mysql_options() {
|
|||||||
echo $MYSQL_ARGS
|
echo $MYSQL_ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arrange_mysql_options() {
|
||||||
|
local opts="$1"
|
||||||
|
|
||||||
|
local rearranged=""
|
||||||
|
for opt in $opts; do
|
||||||
|
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||||
|
rearranged="$opt $rearranged"
|
||||||
|
else
|
||||||
|
rearranged="$rearranged $opt"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$rearranged"
|
||||||
|
}
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# End mysql_options package
|
# End mysql_options package
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
@@ -1388,7 +1403,7 @@ if [ "${0##*/}" = "$TOOL" ] \
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
MYSQL_ARGS="$(mysql_options)"
|
MYSQL_ARGS="$(mysql_options)"
|
||||||
EXT_ARGV="$EXT_ARGV $MYSQL_ARGS"
|
EXT_ARGV="$(arrange_mysql_options "$EXT_ARGV $MYSQL_ARGS")"
|
||||||
|
|
||||||
# Check that mysql and mysqladmin are in PATH. If not, we're
|
# Check that mysql and mysqladmin are in PATH. If not, we're
|
||||||
# already dead in the water, so don't bother with cmd line opts,
|
# already dead in the water, so don't bother with cmd line opts,
|
||||||
@@ -1935,7 +1950,7 @@ pathname.
|
|||||||
|
|
||||||
=item --host
|
=item --host
|
||||||
|
|
||||||
short form: -h; type: string; default: localhost
|
short form: -h; type: string
|
||||||
|
|
||||||
Host to connect to.
|
Host to connect to.
|
||||||
|
|
||||||
|
@@ -47,6 +47,22 @@ mysql_options() {
|
|||||||
echo $MYSQL_ARGS
|
echo $MYSQL_ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This basically makes sure that --defaults-file comes first
|
||||||
|
arrange_mysql_options() {
|
||||||
|
local opts="$1"
|
||||||
|
|
||||||
|
local rearranged=""
|
||||||
|
for opt in $opts; do
|
||||||
|
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||||
|
rearranged="$opt $rearranged"
|
||||||
|
else
|
||||||
|
rearranged="$rearranged $opt"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$rearranged"
|
||||||
|
}
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# End mysql_options package
|
# End mysql_options package
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
Reference in New Issue
Block a user