Skip to content

Commit dab1026

Browse files
docs(service-registry rule): add disable example and fix logs (#1474)
1 parent e0107e0 commit dab1026

6 files changed

Lines changed: 14 additions & 6 deletions

File tree

docs/commands/rhoas_service-registry_rule_disable.md

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/registry/rule/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func runDescribe(opts *options) error {
122122

123123
if opts.artifactID == "" {
124124

125-
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.describe.log.info.fetching.globalRule", localize.NewEntry("Type", opts.ruleType)))
125+
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.describe.log.info.fetching.globalRule", localize.NewEntry("Type", opts.ruleType), localize.NewEntry("ID", opts.registryID)))
126126

127127
req := dataAPI.AdminApi.GetGlobalRuleConfig(opts.Context, *rulecmdutil.GetMappedRuleType(opts.ruleType))
128128

pkg/cmd/registry/rule/disable/disable.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ func disableGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient)
178178

179179
if opts.ruleType != "" {
180180

181-
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.disable.log.info.disabling.globalRule", localize.NewEntry("RuleType", opts.ruleType)))
181+
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.disable.log.info.disabling.globalRule", localize.NewEntry("RuleType", opts.ruleType), localize.NewEntry("ID", opts.registryID)))
182182

183183
req := dataAPI.AdminApi.DeleteGlobalRule(opts.Context, *rulecmdutil.GetMappedRuleType(opts.ruleType))
184184

185185
httpRes, err = req.Execute()
186186
} else {
187187

188-
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.disable.log.info.disabling.globalRules", localize.NewEntry("RuleType", opts.ruleType)))
188+
opts.Logger.Info(opts.localizer.MustLocalize("registry.rule.disable.log.info.disabling.globalRules", localize.NewEntry("ID", opts.registryID)))
189189

190190
req := dataAPI.AdminApi.DeleteAllGlobalRules(opts.Context)
191191

pkg/cmd/registry/rule/enable/enable.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func runEnable(opts *options) error {
152152
opts.localizer.MustLocalize("registry.rule.enable.log.info.enabling.globalRules",
153153
localize.NewEntry("RuleType", opts.ruleType),
154154
localize.NewEntry("Configuration", opts.config),
155+
localize.NewEntry("ID", opts.registryID),
155156
),
156157
)
157158

pkg/cmd/registry/rule/update/update.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func updateGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient)
172172
opts.localizer.MustLocalize("registry.rule.update.log.info.updating.globalRule",
173173
localize.NewEntry("RuleType", opts.ruleType),
174174
localize.NewEntry("Configuration", opts.config),
175+
localize.NewEntry("ID", opts.registryID),
175176
),
176177
)
177178

pkg/core/localize/locales/en/cmd/rule.en.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ one='''
163163
## Disable the global compatibility rule for all artifacts in the current Service Registry instance
164164
$ rhoas service-registry rule disable --rule-type=compatibility
165165
166+
## Disable all enabled rules for all artifacts in the current Service Registry instance
167+
$ rhoas service-registry rule disable
168+
166169
## Disable the global compatibility rule for all artifacts in a specific Service Registry instance
167170
$ rhoas service-registry rule disable --rule-type=compatibility --instance-id=8ecff228-1ffe-4cf5-b38b-55223885ee00
168171
@@ -183,10 +186,10 @@ one='Disabling "{{.RuleType}}" rule for artifact with ID "{{.ArtifactID}}"'
183186
one='Disabling all rules for artifact with ID "{{.ArtifactID}}"'
184187

185188
[registry.rule.disable.flag.yes]
186-
one = 'Disable the rule without prompting for confirmation'
189+
one = 'Skip confirmation to forcibly disable rules'
187190

188191
[registry.rule.disable.confirm]
189-
one='Do you want to disable the specified rule?'
192+
one='Do you want to disable specified rule(s)?'
190193

191194
[registry.rule.disable.log.info.success]
192195
one='Successfully disabled'

0 commit comments

Comments
 (0)