From 144c6513ff63ef8bbfd2a0087b3c2ec598506fc0 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 27 Feb 2020 12:13:37 +1100 Subject: [PATCH] fix provider hostname for azure --- controllers/mariadbconsumer_controller.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/mariadbconsumer_controller.go b/controllers/mariadbconsumer_controller.go index 10c372d..f1bcf75 100644 --- a/controllers/mariadbconsumer_controller.go +++ b/controllers/mariadbconsumer_controller.go @@ -355,8 +355,8 @@ func createDatabaseIfNotExist(provider mariadbv1.MariaDBProviderSpec, consumer m switch provider.Type { case "azure": userName := strings.Split(consumer.Spec.Consumer.Username, "@") - hostName := strings.Split(provider.Hostname, ".") - createUser = fmt.Sprintf("CREATE USER IF NOT EXISTS `%s`@'%s' IDENTIFIED BY '%s';", userName[0], hostName[0], consumer.Spec.Consumer.Password) + // hostName := strings.Split(provider.Hostname, ".") + createUser = fmt.Sprintf("CREATE USER IF NOT EXISTS `%s`@'%%' IDENTIFIED BY '%s';", userName[0], consumer.Spec.Consumer.Password) default: createUser = fmt.Sprintf("CREATE USER IF NOT EXISTS `%s`@'%%' IDENTIFIED BY '%s';", consumer.Spec.Consumer.Username, consumer.Spec.Consumer.Password) } @@ -373,8 +373,8 @@ func createDatabaseIfNotExist(provider mariadbv1.MariaDBProviderSpec, consumer m switch provider.Type { case "azure": userName := strings.Split(consumer.Spec.Consumer.Username, "@") - hostName := strings.Split(provider.Hostname, ".") - grantUser = fmt.Sprintf("GRANT ALL ON `%s`.* TO `%s`@'%s';", consumer.Spec.Consumer.Database, userName[0], hostName[0]) + // hostName := strings.Split(provider.Hostname, ".") + grantUser = fmt.Sprintf("GRANT ALL ON `%s`.* TO `%s`@'%%';", consumer.Spec.Consumer.Database, userName[0]) default: grantUser = fmt.Sprintf("GRANT ALL ON `%s`.* TO `%s`@'%%';", consumer.Spec.Consumer.Database, consumer.Spec.Consumer.Username) } @@ -434,8 +434,8 @@ func dropUser(db *sql.DB, consumer mariadbv1.MariaDBConsumer, provider mariadbv1 switch provider.Type { case "azure": userName := strings.Split(consumer.Spec.Consumer.Username, "@") - hostName := strings.Split(provider.Hostname, ".") - dropUser = fmt.Sprintf("DROP USER `%s`@'%s';", userName[0], hostName[0]) + // hostName := strings.Split(provider.Hostname, ".") + dropUser = fmt.Sprintf("DROP USER `%s`@'%%';", userName[0]) default: dropUser = fmt.Sprintf("DROP USER `%s`@'%%';", consumer.Spec.Consumer.Username) }