sixhop / AutoMySQLBackup

A fork and further development of AutoMySQLBackup from sourceforge. http://sourceforge.net/projects/automysqlbackup/
GNU General Public License v2.0
341 stars 103 forks source link

CONFIG_mysql_dump_encrypted_login cannot be specified via optional config file #3

Closed sebthom closed 7 years ago

sebthom commented 7 years ago

Specifying CONFIG_mysql_dump_encrypted_login='yes' in an optional config file that is loaded when executing automysqlbackup with option -c is ignored by the script. The reason is the following execution flow:

main:
  -> method_backup():
     -> load_default_config():
        -> mysql_commands():
           -> source $CONFIG_configfile
           -> if [ "${CONFIG_mysql_dump_encrypted_login}" = "yes" ]; then configure --login-path; fi
     -> source $CONFIG_configfile
     -> source $opt_config_file

The optional config file is sourced after the mysql_commands function has been invoked which decides whether to use login-path based login or not based on the configuration parameter CONFIG_mysql_dump_encrypted_login.

Also, it looks sub-optimal that the default config file is sourced twice, once in mysql_commands() and again in method_backup()

BigAndini commented 7 years ago

Hi @sebthom,

thanks for reporting this issue. I need to check that and see what's the behaviour when adding a separate config file next to the default in /etc/automysqlbackup/automysqlbackup.conf. You're absolutely right that it doesn't make sense to source the $CONFIG_configfile twice, that's a bug. I check it in the next days and get back to you once I've changed the script and tested the additional functionality.

Cheers Andi

BigAndini commented 7 years ago

Hello, there was a patch to change that. Please have a try if it's working for you now.

sebthom commented 7 years ago

Works, thank you!