Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in this struct's methods still seemed to be useful, so I just renamed it to avoid future confusion

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