fix(cmd/influxd/upgrade): delete references to 'security script' in upgrade command (#19924)

pull/19928/head
Daniel Moran 2020-11-06 15:32:38 -05:00 committed by GitHub
parent 0ae3df0f27
commit a89041b182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 16 deletions

View File

@ -1,5 +1,9 @@
## unreleased
### Bug Fixes
1. [19924](https://github.com/influxdata/influxdb/pull/19924): Remove unused 'security-script' option from upgrade command
## v2.0.0-rc.4 [2020-11-05]
### Features

View File

@ -25,7 +25,7 @@ func upgradeUsers(ctx context.Context, v1 *influxDBv1, v2 *influxDBv2, targetOpt
}
// get helper instance
helper := newSecurityScriptHelper(log)
helper := newSecurityUpgradeHelper(log)
// check if target buckets exists in 2.x
proceed := helper.checkDbBuckets(v1meta, dbBuckets)
@ -104,20 +104,20 @@ func upgradeUsers(ctx context.Context, v1 *influxDBv1, v2 *influxDBv2, targetOpt
return nil
}
// securityScriptHelper is a helper used by `generate-security-script` command.
type securityScriptHelper struct {
// securityUpgradeHelper is a helper used by `upgrade` command.
type securityUpgradeHelper struct {
log *zap.Logger
}
// newSecurityScriptHelper returns new security script helper instance for `generate-security-script` command.
func newSecurityScriptHelper(log *zap.Logger) *securityScriptHelper {
helper := &securityScriptHelper{
// newSecurityUpgradeHelper returns new security script helper instance for `upgrade` command.
func newSecurityUpgradeHelper(log *zap.Logger) *securityUpgradeHelper {
helper := &securityUpgradeHelper{
log: log,
}
return helper
}
func (h *securityScriptHelper) checkDbBuckets(meta *meta.Client, databases map[string][]platform.ID) bool {
func (h *securityUpgradeHelper) checkDbBuckets(meta *meta.Client, databases map[string][]platform.ID) bool {
ok := true
for _, row := range meta.Users() {
for database := range row.Privileges {
@ -135,7 +135,7 @@ func (h *securityScriptHelper) checkDbBuckets(meta *meta.Client, databases map[s
return ok
}
func (h *securityScriptHelper) sortUserInfo(info []meta.UserInfo) []meta.UserInfo {
func (h *securityUpgradeHelper) sortUserInfo(info []meta.UserInfo) []meta.UserInfo {
sort.Slice(info, func(i, j int) bool {
return info[i].Name < info[j].Name
})

View File

@ -76,7 +76,6 @@ type optionsV2 struct {
token string
retention string
influx2CommandPath string
securityScriptPath string
}
func (o *optionsV2) checkPaths() error {
@ -122,7 +121,6 @@ func NewCommand() *cobra.Command {
Upgrades a 1.x version of InfluxDB by performing the following actions:
1. Reads the 1.x config file and creates a 2.x config file with matching options. Unsupported 1.x options are reported.
2. Copies 1.x database files.
3. Generates a script that will create tokens with permissions equivalent to the 1.x users. This script needs to be revised and run manually after starting 2.x.
If the config file is not available, 1.x db folder (--v1-dir options) is taken as an input.
Target 2.x database dir is specified by the --engine-path option. If changed, the bolt path should be changed as well.
@ -216,12 +214,6 @@ func NewCommand() *cobra.Command {
Default: influxExePathV2(),
Desc: "path to influx command",
},
{
DestP: &options.target.securityScriptPath,
Flag: "security-script",
Default: filepath.Join(homeOrAnyDir(), "influxd-upgrade-security.sh"),
Desc: "optional: generated security upgrade script path",
},
{
DestP: &options.logPath,
Flag: "log-path",