Skip to content

Commit

Permalink
fix(cmd/influxd/upgrade): delete references to 'security script' in u…
Browse files Browse the repository at this point in the history
…pgrade command (#19924)
  • Loading branch information
danxmoran authored Nov 6, 2020
1 parent 0ae3df0 commit a89041b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions cmd/influxd/upgrade/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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
})
Expand Down
8 changes: 0 additions & 8 deletions cmd/influxd/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ type optionsV2 struct {
token string
retention string
influx2CommandPath string
securityScriptPath string
}

func (o *optionsV2) checkPaths() error {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit a89041b

Please sign in to comment.