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

docs(service-registry rule): add disable example and fix logs #1474

Merged
merged 1 commit into from
Mar 20, 2022
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
5 changes: 4 additions & 1 deletion docs/commands/rhoas_service-registry_rule_disable.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cmd/registry/rule/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func runDescribe(opts *options) error {

if opts.artifactID == "" {

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

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

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/registry/rule/disable/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ func disableGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient)

if opts.ruleType != "" {

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

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

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

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

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

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/registry/rule/enable/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func runEnable(opts *options) error {
opts.localizer.MustLocalize("registry.rule.enable.log.info.enabling.globalRules",
localize.NewEntry("RuleType", opts.ruleType),
localize.NewEntry("Configuration", opts.config),
localize.NewEntry("ID", opts.registryID),
),
)

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/registry/rule/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func updateGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient)
opts.localizer.MustLocalize("registry.rule.update.log.info.updating.globalRule",
localize.NewEntry("RuleType", opts.ruleType),
localize.NewEntry("Configuration", opts.config),
localize.NewEntry("ID", opts.registryID),
),
)

Expand Down
7 changes: 5 additions & 2 deletions pkg/core/localize/locales/en/cmd/rule.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ one='''
## Disable the global compatibility rule for all artifacts in the current Service Registry instance
$ rhoas service-registry rule disable --rule-type=compatibility

## Disable all enabled rules for all artifacts in the current Service Registry instance
$ rhoas service-registry rule disable

## Disable the global compatibility rule for all artifacts in a specific Service Registry instance
$ rhoas service-registry rule disable --rule-type=compatibility --instance-id=8ecff228-1ffe-4cf5-b38b-55223885ee00

Expand All @@ -183,10 +186,10 @@ one='Disabling "{{.RuleType}}" rule for artifact with ID "{{.ArtifactID}}"'
one='Disabling all rules for artifact with ID "{{.ArtifactID}}"'

[registry.rule.disable.flag.yes]
one = 'Disable the rule without prompting for confirmation'
one = 'Skip confirmation to forcibly disable rules'

[registry.rule.disable.confirm]
one='Do you want to disable the specified rule?'
one='Do you want to disable specified rule(s)?'

[registry.rule.disable.log.info.success]
one='Successfully disabled'
Expand Down