Skip to content

Commit

Permalink
fix provider hostname for azure
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Feb 27, 2020
1 parent 635108b commit 144c651
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controllers/mariadbconsumer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 144c651

Please sign in to comment.