From 8d2836b588ff1811da7a357f3b1b776cebd4bfbd Mon Sep 17 00:00:00 2001 From: Giuseppe Maxia Date: Sat, 25 May 2019 13:33:16 +0200 Subject: [PATCH] Fix issue #80 NDB tarballs wrongly labeled NDB tarballs were wrongly labeled as regular "mysql" flavor. Now they are labeled correctly --- .build/VERSION | 2 +- Changelog | 3 +++ cmd/unpack.go | 17 +++++++++++++++-- common/version.go | 4 ++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.build/VERSION b/.build/VERSION index 034552a8..7f3c3aff 100644 --- a/.build/VERSION +++ b/.build/VERSION @@ -1 +1 @@ -1.30.0 +1.30.1 diff --git a/Changelog b/Changelog index 71658798..317438dc 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +1.30.1 22-May-2019 + BUGS FIXED + - Fix issue #80 NDB tarballs are wrongly labeled as regular "mysql" flavor 1.30.0 05-May-2019 BUGS FIXED - Fix Issue #72 Catalog operations can clash with multiple dbdeployer runs diff --git a/cmd/unpack.go b/cmd/unpack.go index 6cacafdf..8b1a9296 100644 --- a/cmd/unpack.go +++ b/cmd/unpack.go @@ -22,10 +22,11 @@ import ( "regexp" "strings" + "github.com/spf13/cobra" + "github.com/datacharmer/dbdeployer/common" "github.com/datacharmer/dbdeployer/globals" "github.com/datacharmer/dbdeployer/unpack" - "github.com/spf13/cobra" ) // Tries to detect the database flavor from tarball name @@ -40,7 +41,19 @@ func detectTarballFlavor(tarballName string) string { common.MySQLFlavor: `mysql`, } - for key, value := range flavorsRegexps { + // Flavors must be evaluated in order, or else + // "mysql-cluster" may be detected as "mysql" + flavorDetectionList := []string{ + common.PerconaServerFlavor, + common.MariaDbFlavor, + common.NdbFlavor, + common.TiDbFlavor, + common.PxcFlavor, + common.MySQLFlavor, + } + + for _, key := range flavorDetectionList { + value := flavorsRegexps[key] re := regexp.MustCompile(value) if re.MatchString(tarballName) { return key diff --git a/common/version.go b/common/version.go index 9a582f43..cd98a67c 100644 --- a/common/version.go +++ b/common/version.go @@ -16,9 +16,9 @@ package common // This file was generated during build. Do not edit. -// Build time: 2019-05-05 05:18 +// Build time: 2019-05-22 20:50 -var VersionDef string = "1.30.0" // 2019-05-05 +var VersionDef string = "1.30.1" // 2019-05-22 // Compatible version is the version used to mark compatible archives (templates, configuration). // It is usually major.minor.0, except when we are at version 0.x, when