Skip to content

Commit b1cf115

Browse files
committed
Rename flag
1 parent 34895e5 commit b1cf115

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

cmd/topicctl/subcmd/apply.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type applyCmdConfig struct {
3636
retentionDropStepDurationStr string
3737
skipConfirm bool
3838
ignoreFewerPartitionsError bool
39-
allowSettingsDeletion bool
39+
destructive bool
4040
sleepLoopDuration time.Duration
4141
failFast bool
4242

@@ -109,8 +109,8 @@ func init() {
109109
"Don't return error when topic's config specifies fewer partitions than it currently has",
110110
)
111111
applyCmd.Flags().BoolVar(
112-
&applyConfig.allowSettingsDeletion,
113-
"allow-settings-deletion",
112+
&applyConfig.destructive,
113+
"destructive",
114114
false,
115115
"Deletes topic settings from the broker if the setting is set on the broker but not in config",
116116
)
@@ -266,8 +266,7 @@ func applyTopic(
266266
RetentionDropStepDuration: applyConfig.retentionDropStepDuration,
267267
SkipConfirm: applyConfig.skipConfirm,
268268
IgnoreFewerPartitionsError: applyConfig.ignoreFewerPartitionsError,
269-
AllowSettingsDeletion: applyConfig.allowSettingsDeletion,
270-
SleepLoopDuration: applyConfig.sleepLoopDuration,
269+
Destructive: applyConfig.destructive,
271270
TopicConfig: topicConfig,
272271
}
273272

cmd/topicctl/subcmd/rebalance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func rebalanceApplyTopic(
307307
AutoContinueRebalance: true, // to continue without prompts
308308
RetentionDropStepDuration: retentionDropStepDuration, // not needed for rebalance
309309
SkipConfirm: true, // to enforce action: rebalance
310-
AllowSettingsDeletion: false, // Irrelevant here
310+
Destructive: false, // Irrelevant here
311311
SleepLoopDuration: rebalanceConfig.sleepLoopDuration,
312312
TopicConfig: topicConfig,
313313
}

pkg/apply/apply.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type TopicApplierConfig struct {
3737
RetentionDropStepDuration time.Duration
3838
SkipConfirm bool
3939
IgnoreFewerPartitionsError bool
40-
AllowSettingsDeletion bool
40+
Destructive bool
4141
SleepLoopDuration time.Duration
4242
TopicConfig config.TopicConfig
4343
}
@@ -425,7 +425,7 @@ func (t *TopicApplier) updateSettings(
425425
}
426426
}
427427

428-
if len(missingKeys) > 0 && t.config.AllowSettingsDeletion {
428+
if len(missingKeys) > 0 && t.config.Destructive {
429429
log.Infof(
430430
"Found %d key(s) set in cluster but missing from config for deletion:\n%s",
431431
len(missingKeys),
@@ -461,7 +461,7 @@ func (t *TopicApplier) updateSettings(
461461
}
462462
}
463463

464-
if len(missingKeys) > 0 && !t.config.AllowSettingsDeletion {
464+
if len(missingKeys) > 0 && !t.config.Destructive {
465465
log.Warnf(
466466
"Found %d key(s) set in cluster but missing from config:\n%s\nThese will be left as-is.",
467467
len(missingKeys),

pkg/apply/apply_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestApplyBasicUpdates(t *testing.T) {
8282
require.NotNil(t, err)
8383
applier.topicConfig.Spec.ReplicationFactor = 2
8484

85-
// Settings are not deleted if AllowSettingsDeletion is false. They are
85+
// Settings are not deleted if Destructive is false. They are
8686
// if it is true
8787
delete(applier.topicConfig.Spec.Settings, "cleanup.policy")
8888
err = applier.Apply(ctx)
@@ -92,7 +92,7 @@ func TestApplyBasicUpdates(t *testing.T) {
9292

9393
assert.Equal(t, "delete", topicInfo.Config["cleanup.policy"])
9494

95-
applier.config.AllowSettingsDeletion = true
95+
applier.config.Destructive = true
9696
err = applier.Apply(ctx)
9797
require.NoError(t, err)
9898
topicInfo, err = applier.adminClient.GetTopic(ctx, topicName, true)

0 commit comments

Comments
 (0)