o ckF[ùã@sXdZddlmZddlZddlZddlmZddlmZddl Z dZ Gdd„deƒZ 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&eZdZdd„Zddd„Zdd„ZdS) ÚMySQLcCs| d¡|jdddddS)Nzapt-get updatezapt-get -y install mysql-serverT)ÚnotifyÚ exit_on_error)Úrun©Úself©r úD/usr/lib/python3/dist-packages/boto/pyami/installers/ubuntu/mysql.pyÚinstall-s z MySQL.installNc Csªtj ddd¡}d}tdƒ}| ¡| ¡dkrHt d¡d}| d¡dkr>|d kr>t d ¡|d }| d¡dkr>|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 ¡t d¡d|} | | ¡dkrÓt d ¡| | ¡dksÅdSdS)NrÚdata_dirz/mntFzmysqladmin pingré zecho 'quit' | mysql -u rootééz/etc/init.d/mysql stopzpkill -9 mysqlÚmysqlzmkdir %sTzchown -R mysql:mysql %sz/etc/mysql/conf.d/use_mnt.cnfÚwz# 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.cnfÚclientÚpasswordzrecho "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '%s' WITH GRANT OPTION;" | mysql)ÚbotoÚconfigÚgetrrÚ getStatusÚtimeÚsleepÚosÚpathÚjoinÚexistsÚopenÚwriteÚcloseÚstartrÚread) r rrÚ fresh_installÚis_mysql_running_commandÚiÚ mysql_pathÚfpÚ config_parserÚ grant_commandr r r Úchange_data_dir8sJ   þ           ÿzMySQL.change_data_dircCs| ¡| ¡dS©N)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