Commit e66befcf authored by cweagans's avatar cweagans Committed by ergonlogic

Issue #2069387 by cweagans: Added Support nonstandard database port on hostmaster-install command.

parent ea1c2c87
......@@ -13,7 +13,7 @@
* @see Provision_Service_db_mysql::grant_host().
*/
function drush_provision_hostmaster_install_pre_validate() {
$command = sprintf('mysql -u intntnllyInvalid -h %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost'));
$command = sprintf('mysql -u intntnllyInvalid -h %s -P %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost'), drush_get_option('aegir_db_port', '3306'));
drush_shell_exec($command);
if (preg_match("/Access denied for user 'intntnllyInvalid'@'([^']*)'/", implode('', drush_shell_exec_output()), $match)) {
......@@ -39,6 +39,7 @@ function drush_provision_hostmaster_install_validate($site = NULL) {
drush_set_default('web_group', _provision_default_web_group());
drush_set_default('http_service_type', 'apache');
drush_set_default('aegir_db_user', 'root');
drush_set_default('aegir_db_port', '3306');
drush_set_default('client_name', 'admin');
$aegir_db_user = drush_get_option('aegir_db_user');
drush_set_default('makefile', dirname(__FILE__) . '/aegir.make');
......@@ -64,7 +65,7 @@ Don't worry: you will get to review those settings after the final install");
system('stty -echo');
drush_set_option('aegir_db_pass', drush_prompt(dt('MySQL privileged user ("!root") password', array('!root' => $aegir_db_user))));
system('stty echo');
print "\n"; // add a newline since the user's didn't print
print "\n"; // add a newline since the user's didn't print
}
if (drush_get_option('aegir_host') == 'localhost') {
......@@ -101,6 +102,7 @@ The following settings will be used:
Aegir DB host: !db_host
Aegir DB user: !db_user
Aegir DB password: !db_pass
Aegir DB port: !db_port
Aegir version: !version
Aegir platform path: !root
Aegir makefile: !makefile
......@@ -114,6 +116,7 @@ The following settings will be used:
'!db_host' => drush_get_option('aegir_db_host'),
'!db_user' => drush_get_option('aegir_db_user'),
'!db_pass' => is_null(drush_get_option('aegir_db_pass', NULL, 'process')) ? '<previously set>' : '<prompted>',
'!db_port' => drush_get_option('aegir_db_port'),
'!version' => drush_get_option('version'),
'!root' => drush_get_option(array('r', 'root')),
'!makefile' => drush_get_option('makefile'),
......@@ -138,7 +141,8 @@ function drush_provision_hostmaster_install($site = NULL) {
$aegir_db_user = drush_get_option('aegir_db_user');
$aegir_db_pass = drush_get_option('aegir_db_pass');
$aegir_db_port = drush_get_option('aegir_db_port');
$server = '@server_master';
$master_context = array(
'context_type' => 'server',
......@@ -150,9 +154,10 @@ function drush_provision_hostmaster_install($site = NULL) {
'http_service_type' => drush_get_option('http_service_type'),
'web_group' => drush_get_option('web_group'),
'master_url' => "http://" . $site,
'db_port' => $aegir_db_port,
);
$master_db = sprintf("mysql://%s:%s@%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), drush_get_option('aegir_db_host'));
$master_db = sprintf("mysql://%s:%s@%s:%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), drush_get_option('aegir_db_host'), $aegir_db_port);
if (drush_get_option('aegir_host') == drush_get_option('aegir_db_host')) {
$master_context['db_service_type'] = 'mysql';
$master_context['master_db'] = $master_db;
......@@ -164,6 +169,7 @@ function drush_provision_hostmaster_install($site = NULL) {
'context_type' => 'server',
'db_service_type' => 'mysql',
'master_db' => $master_db,
'db_port' => $aegir_db_port,
);
drush_invoke_process('@none', "provision-save", array($dbserver), $dbserver_context);
provision_backend_invoke($dbserver, 'provision-verify');
......@@ -171,7 +177,7 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_invoke_process('@none', "provision-save", array($server), $master_context);
provision_backend_invoke($server, 'provision-verify');
// exit if an error has occured.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......@@ -195,7 +201,7 @@ function drush_provision_hostmaster_install($site = NULL) {
}
provision_backend_invoke($platform_name, 'provision-verify', array(), $options);
// exit if an error has occured.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......@@ -215,7 +221,7 @@ function drush_provision_hostmaster_install($site = NULL) {
$data = provision_backend_invoke($site_name, 'provision-install', array(), array('client_email' => drush_get_option('client_email')));
provision_backend_invoke($site_name, 'provision-verify');
// exit if an error has occured.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......
......@@ -280,6 +280,7 @@ function provision_drush_command() {
'aegir_db_host' => dt('Database host to connect to (default: %host)', array('%host' => 'localhost')),
'aegir_db_user' => dt('Database user to connect as (default: %user)', array('%user' => 'root')),
'aegir_db_pass' => dt('Database password to use'),
'aegir_db_port' => dt('Database port to use (default: %port)', array('%port' => '3306')),
'client_email' => dt('Email of the first client to create in the frontend'),
'client_name' => dt('Name of the first client to create in the frontend (default: %user)', array('%user' => 'admin')),
'makefile' => dt('The makefile used to create the hostmaster platform (default: %makefile)', array('%makefile' => dirname(__FILE__). '/aegir.make')),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment