@@ -104,25 +104,25 @@ def pre_pref(self, apt_packages):
104104
105105 if set (EEVariables .ee_mysql ).issubset (set (apt_packages )):
106106 Log .info (self , "Adding repository for MySQL, please wait..." )
107- mysql_pref = ("Package: *\n Pin: origin mirror.aarnet.edu.au "
107+ mysql_pref = ("Package: *\n Pin: origin sfo1.mirrors.digitalocean.com "
108108 "\n Pin-Priority: 1000\n " )
109109 with open ('/etc/apt/preferences.d/'
110110 'MariaDB.pref' , 'w' ) as mysql_pref_file :
111111 mysql_pref_file .write (mysql_pref )
112- if EEVariables .ee_platform_codename != 'jessie' :
113- EERepo .add (self , repo_url = EEVariables .ee_mysql_repo )
114- Log .debug (self , 'Adding key for {0}'
115- .format (EEVariables .ee_mysql_repo ))
116- EERepo .add_key (self , '0xcbcb082a1bb943db' ,
112+ # if EEVariables.ee_platform_codename != 'jessie':
113+ EERepo .add (self , repo_url = EEVariables .ee_mysql_repo )
114+ Log .debug (self , 'Adding key for {0}'
115+ .format (EEVariables .ee_mysql_repo ))
116+ EERepo .add_key (self , '0xcbcb082a1bb943db' ,
117117 keyserver = "keyserver.ubuntu.com" )
118118 chars = '' .join (random .sample (string .ascii_letters , 8 ))
119119 Log .debug (self , "Pre-seeding MySQL" )
120- Log .debug (self , "echo \" mariadb-server-10.0 "
120+ Log .debug (self , "echo \" mariadb-server-10.1 "
121121 "mysql-server/root_password "
122122 "password \" | "
123123 "debconf-set-selections" )
124124 try :
125- EEShellExec .cmd_exec (self , "echo \" mariadb-server-10.0 "
125+ EEShellExec .cmd_exec (self , "echo \" mariadb-server-10.1 "
126126 "mysql-server/root_password "
127127 "password {chars}\" | "
128128 "debconf-set-selections"
@@ -131,12 +131,12 @@ def pre_pref(self, apt_packages):
131131 except CommandExecutionError as e :
132132 Log .error ("Failed to initialize MySQL package" )
133133
134- Log .debug (self , "echo \" mariadb-server-10.0 "
134+ Log .debug (self , "echo \" mariadb-server-10.1 "
135135 "mysql-server/root_password_again "
136136 "password \" | "
137137 "debconf-set-selections" )
138138 try :
139- EEShellExec .cmd_exec (self , "echo \" mariadb-server-10.0 "
139+ EEShellExec .cmd_exec (self , "echo \" mariadb-server-10.1 "
140140 "mysql-server/root_password_again "
141141 "password {chars}\" | "
142142 "debconf-set-selections"
@@ -1226,16 +1226,17 @@ def post_pref(self, apt_packages, packages):
12261226 raise SiteError ("Unable to import Anemometer database" )
12271227
12281228 EEMysql .execute (self , 'grant select on *.* to \' anemometer\' '
1229- '@\' {0}\' ' .format (self .app .config .get ('mysql' ,
1230- 'grant-host' )))
1229+ '@\' {0}\' IDENTIFIED'
1230+ ' BY \' {1}\' ' .format (self .app .config .get ('mysql' ,
1231+ 'grant-host' ),chars ))
12311232 Log .debug (self , "grant all on slow-query-log.*"
12321233 " to anemometer@root_user IDENTIFIED BY password " )
12331234 EEMysql .execute (self , 'grant all on slow_query_log.* to'
12341235 '\' anemometer\' @\' {0}\' IDENTIFIED'
12351236 ' BY \' {1}\' ' .format (self .app .config .get (
12361237 'mysql' , 'grant-host' ),
12371238 chars ),
1238- errormsg = "cannot grant privillages " , log = False )
1239+ errormsg = "cannot grant priviledges " , log = False )
12391240
12401241 # Custom Anemometer configuration
12411242 Log .debug (self , "configration Anemometer" )
@@ -1817,24 +1818,20 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
18171818 if EEVariables .ee_ram < 512 :
18181819 Log .debug (self , "Setting maxmemory variable to {0} in redis.conf"
18191820 .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.1 )))
1820- EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1821- "# maxmemory <bytes>" ,
1822- "maxmemory {0}" .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.1 )))
1821+ EEShellExec .cmd_exec (self , "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
1822+ .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.1 )))
18231823 Log .debug (self , "Setting maxmemory-policy variable to volatile-lru in redis.conf" )
1824- EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1825- "# maxmemory-policy volatile-lru" ,
1826- "maxmemory-policy volatile-lru" )
1824+ EEShellExec .cmd_exec (self , "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' "
1825+ "/etc/redis/redis.conf" )
18271826 EEService .restart_service (self , 'redis-server' )
18281827 else :
18291828 Log .debug (self , "Setting maxmemory variable to {0} in redis.conf"
18301829 .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.2 )))
1831- EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1832- "# maxmemory <bytes>" ,
1833- "maxmemory {0}" .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.2 )))
1830+ EEShellExec .cmd_exec (self , "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
1831+ .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.2 )))
18341832 Log .debug (self , "Setting maxmemory-policy variable to volatile-lru in redis.conf" )
1835- EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1836- "# maxmemory-policy volatile-lru" ,
1837- "maxmemory-policy volatile-lru" )
1833+ EEShellExec .cmd_exec (self , "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' "
1834+ "/etc/redis/redis.conf" )
18381835 EEService .restart_service (self , 'redis-server' )
18391836 if disp_msg :
18401837 if len (self .msg ):
0 commit comments