o ckF[@sXdZddlmZddlZddlZddlmZddlmZddl Z dZ GdddeZ dS) aR This installer will install mysql-server on an Ubuntu machine. In addition to the normal installation done by apt-get, it will also configure the new MySQL server to store it's data files in a different location. By default, this is /mnt but that can be configured in the [MySQL] section of the boto config file passed to the instance. ) InstallerN) ShellCommand) ConfigParserz [MySQL] root_password = data_dir = c@s&eZdZddZdddZddZdS) MySQLcCs|d|jdddddS)Nzapt-get updatezapt-get -y install mysql-serverT)notify exit_on_error)runselfr D/usr/lib/python3/dist-packages/boto/pyami/installers/ubuntu/mysql.pyinstall-s z MySQL.installNc Cstjddd}d}td}||dkrHtdd}|ddkr>|d kr>td |d }|ddkr>|d ks*|d |d tj |d }tj |s^|d|d}|d|t dd}| d| d|| d| d|| dtj |d||r|d||d dSt}|d|dd}|d tdd|} || dkrtd || dksdSdS)Nrdata_dirz/mntFzmysqladmin pingr zecho 'quit' | mysql -u rootz/etc/init.d/mysql stopzpkill -9 mysqlmysqlzmkdir %sTzchown -R mysql:mysql %sz/etc/mysql/conf.d/use_mnt.cnfwz# created by pyami z# use the %s volume for data z [mysqld] z datadir = %s z log_bin = %s z mysql-bin.logzcp -pr /var/lib/mysql/* %s/z/etc/mysql/debian.cnfclientpasswordzrecho "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '%s' WITH GRANT OPTION;" | mysql)botoconfiggetrr getStatustimesleepospathjoinexistsopenwriteclosestartrread) r rr fresh_installis_mysql_running_commandi mysql_pathfp config_parser grant_commandr r r change_data_dir8sJ              zMySQL.change_data_dircCs||dSN)r r,r r r r maings z MySQL.mainr-)__name__ __module__ __qualname__r r,r.r r r r r+s /r) __doc__&boto.pyami.installers.ubuntu.installerrrr boto.utilsr boto.compatrr ConfigSectionrr r r r s