Skip to content

fix(peering): clearer error when peering is disabled - #23752

Open
locker95 wants to merge 1 commit into
hashicorp:mainfrom
locker95:fix/peering-list-disabled-error-14896
Open

fix(peering): clearer error when peering is disabled#23752
locker95 wants to merge 1 commit into
hashicorp:mainfrom
locker95:fix/peering-list-disabled-error-14896

Conversation

@locker95

Copy link
Copy Markdown

Description

When a cluster is configured with peering.enabled = false, operators running consul peering list used to get a vague failure and had to dig into logs to understand why.

This change makes the peering RPC layer return a clear peering is disabled error for all peering endpoints when peering is turned off. The CLI already surfaces the RPC error as:

Error listing peerings: Unexpected response code: 500 (peering is disabled)

So the reason is now explicit and matches the wording requested in the issue.

Testing & Reproduction steps

  1. Start a server with peering disabled:
peering {
  enabled = false
}
  1. Run:
consul peering list
  1. Expect an error that includes peering is disabled rather than a bare Error listing peerings.

Unit / integration coverage:

  • TestPeeringService_PeeringDisabled (updated expected message)
  • TestListCommand_PeeringDisabled (new CLI regression test)
  • cache-type tests updated for the new error string

Links

Fixes #14896

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

When peering.enabled=false, peering list and other peering RPCs now
return "peering is disabled" so operators see the reason instead of a
generic failure. Add a CLI regression test for consul peering list.

Fixes hashicorp#14896

Signed-off-by: Dean Chen <862469039@qq.com>
@locker95
locker95 requested review from a team as code owners July 22, 2026 08:02
@github-actions github-actions Bot added the theme/cli Flags and documentation for the CLI interface label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/cli Flags and documentation for the CLI interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peering: improved error message of peering list

1 participant