def locales(names): """ Require the list of locales to be available. Raises UnsupportedLocales if some of the required locales are not supported. """ family = distrib_family() if family == 'debian': command = 'dpkg-reconfigure --frontend=noninteractive locales' if distrib_id() == 'Ubuntu': config_file = '/var/lib/locales/supported.d/local' if not is_file(config_file): run_as_root('touch %s' % config_file) else: config_file = '/etc/locale.gen' _locales_generic(names, config_file=config_file, command=command) elif family in ['arch', 'gentoo']: _locales_generic(names, config_file='/etc/locale.gen', command='locale-gen') elif distrib_family() == 'redhat': _locales_redhat(names) else: raise UnsupportedFamily( supported=['debian', 'arch', 'gentoo', 'redhat'])
def _test_barracuda(self): d_id = distrib_id() print('d_id:', d_id) d_release = distrib_release() print('d_release:', d_release) mysql = MySQLSatchel() mysql.install_packages() try: mysql_version = mysql.get_mysql_version() mysql_conf_path = mysql.conf_path print('mysql_version:', mysql_version) if d_id == UBUNTU: if d_release == '14.04': assert mysql_version == '5.6' assert mysql_conf_path == '/etc/mysql/my.cnf' elif d_release == '16.04': assert mysql_version == '5.7' assert mysql_conf_path == '/etc/mysql/mysql.conf.d/mysqld.cnf' # Reproduce "Row size too large" error. # https://bugs.mysql.com/bug.php?id=69336 mysql.write_to_file( content=''' #!/bin/bash n=$1 : ${n:=228} cat<<GO > m2b.sql CREATE DATABASE IF NOT EXISTS test; use test; set global innodb_file_format=Barracuda; set global innodb_file_format_max=Barracuda; set global innodb_file_per_table=1; drop table if exists foo; create table foo ( id int auto_increment primary key, v varchar(32) GO for i in `seq 1 $n` ; do echo ", col$i text" done >> m2b.sql echo ") ENGINE=MyISAM;" >> m2b.sql echo "alter table foo engine=innodb row_format=dynamic;" >> m2b.sql ''', fn='/tmp/create.sh') mysql.run('cd /tmp; bash /tmp/create.sh') mysql.sudo('cd /tmp; mysql < m2b.sql') finally: #mysql.purge_packages() pass
def _choose(old_style, new_style): family = distrib_family() if family == 'debian': distrib = distrib_id() at_least_trusty = (distrib == 'Ubuntu' and V(distrib_release()) >= V('14.04')) at_least_jessie = (distrib == 'Debian' and V(distrib_release()) >= V('8.0')) if at_least_trusty or at_least_jessie: return new_style else: return old_style else: raise UnsupportedFamily(supported=['debian'])
def conf_path(self): """ Retrieves the path to the MySQL configuration file. """ from burlap.system import distrib_id, distrib_release hostname = self.current_hostname if hostname not in self._conf_cache: self.env.conf_specifics[hostname] = self.env.conf_default d_id = distrib_id() d_release = distrib_release() for key in ((d_id, d_release), (d_id, )): if key in self.env.conf_specifics: self._conf_cache[hostname] = self.env.conf_specifics[key] return self._conf_cache[hostname]
def conf_path(self): """ Retrieves the path to the MySQL configuration file. """ from burlap.system import distrib_id, distrib_release hostname = self.current_hostname if hostname not in self._conf_cache: self.env.conf_specifics[hostname] = self.env.conf_default d_id = distrib_id() d_release = distrib_release() for key in ((d_id, d_release), (d_id,)): if key in self.env.conf_specifics: self._conf_cache[hostname] = self.env.conf_specifics[key] return self._conf_cache[hostname]
def locales(names): """ Require the list of locales to be available. Raises UnsupportedLocales if some of the required locales are not supported. """ family = distrib_family() if family == 'debian': command = 'dpkg-reconfigure --frontend=noninteractive locales' if distrib_id() == 'Ubuntu': config_file = '/var/lib/locales/supported.d/local' if not is_file(config_file): run_as_root('touch %s' % config_file) else: config_file = '/etc/locale.gen' _locales_generic(names, config_file=config_file, command=command) elif family in ['arch', 'gentoo']: _locales_generic(names, config_file='/etc/locale.gen', command='locale-gen') elif distrib_family() == 'redhat': _locales_redhat(names) else: raise UnsupportedFamily(supported=['debian', 'arch', 'gentoo', 'redhat'])