Skip to content

Commit

Permalink
Remove escaping, broke the remote functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
infostreams committed Nov 30, 2019
1 parent 5e867bc commit 452cc0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 4 additions & 6 deletions bin/drivers/mysql/connectors/ssh/load
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ restore_table() {
is_gzip="${?}"

cmd="mysql --user='${_user}' --host='${_host}' --password='${_pass}' ${_database}"
escape_commandline "${cmd}"

if [ "${is_gzip}" -eq 0 ]; then
# this is a gzipped file
gunzip < "${file}" | "${extract}" -t "${table}" | ssh ${where} "nice -n 19 sh -c '${escaped}'"
gunzip < "${file}" | "${extract}" -t "${table}" | ssh ${where} "nice -n 19 sh -c '${cmd}'"
else
# this is a regular .sql file
cat "${file}" | "${extract}" -t "${table}" | ssh ${where} "nice -n 19 sh -c '${escaped}'"
cat "${file}" | "${extract}" -t "${table}" | ssh ${where} "nice -n 19 sh -c '${cmd}'"
fi

code="${?}"
Expand All @@ -49,14 +48,13 @@ restore_snapshot() {
is_gzip="${?}"

cmd="mysql --user='${_user}' --host='${_host}' --password='${_pass}' ${_database}"
escape_commandline "${cmd}"

if [ "${is_gzip}" -eq 0 ]; then
# this is a gzipped file
gunzip < "${file}" | grep -v "DROP DATABASE"| grep -v "^CREATE DATABASE" | grep -v "^USE \`" | ssh ${where} "nice -n 19 sh -c '${escaped}'"
gunzip < "${file}" | grep -v "DROP DATABASE"| grep -v "^CREATE DATABASE" | grep -v "^USE \`" | ssh ${where} "nice -n 19 sh -c '${cmd}'"
else
# this is a regular .sql file
cat "${file}" | grep -v "DROP DATABASE"| grep -v "^CREATE DATABASE" | grep -v "^USE \`" | ssh ${where} "nice -n 19 sh -c '${escaped}'"
cat "${file}" | grep -v "DROP DATABASE"| grep -v "^CREATE DATABASE" | grep -v "^USE \`" | ssh ${where} "nice -n 19 sh -c '${cmd}'"
fi

code="${?}"
Expand Down
3 changes: 1 addition & 2 deletions bin/drivers/mysql/connectors/ssh/save
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ _pass=$(printf %q $(cat "${connection_config}" | grep "^password" | cut -d '=' -
_host=$(printf %q $(cat "${connection_config}" | grep "^host" | cut -d '=' -f 2 | xargs))

cmd="mysqldump --opt -B --add-drop-database --skip-extended-insert --user='${_user}' --host='${_host}' --password='${_pass}' ${database} | gzip"
escape_commandline "${cmd}"

ssh ${where} "nice -n 19 sh -c '${escaped}'" > "${file}"
ssh ${where} "nice -n 19 sh -c '${cmd}'" > "${file}"

exit $?

0 comments on commit 452cc0b

Please sign in to comment.