hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.31k stars 4.42k forks source link

CLI: consul operator autopilot set-config -disable-upgrade-migration false not working #19266

Open huikang opened 1 year ago

huikang commented 1 year ago

Overview of the Issue

After disable-upgrade-migration is set to true, it can't be reset to false using the format of -disable-upgrade-migration false. Although -disable-upgrade-migration=false works, this inconsistency in the CLI will confuse the users.

Further, there might be more cli sub-command with boolean argument have this issue.


Reproduction Steps

Steps to reproduce this issue

1) start a single server agent, 2) consul operator autopilot set-config -disable-upgrade-migration true , 3) consul operator autopilot get-config to verify disable-upgrade-migration is true, 4) consul operator autopilot set-config -disable-upgrade-migration false to set it back to false 5) consul operator autopilot get-config is still true and auto migration won't happen

Consul info for both Client and Server

vijayraghav-io commented 12 months ago

Hi @huikang , i am working on this.

vijayraghav-io commented 12 months ago

@huikang PR https://github.com/hashicorp/consul/pull/19291 is ready for review. Tested different scenarios and included test cases as well.

vijayraghav-io commented 12 months ago

@huikang, updated to support following scenario :

Example : consul operator autopilot set-config -disable-upgrade-migration -cleanup-dead-servers=false -min-quorum 5

In the above example the value for boolean flag -disable-upgrade-migration is not provided, so the value will be assumed to be true. This works the same way , while also handling -disable-upgrade-migration false -cleanup-dead-servers=false -min-quorum 5 scenario.

With this all scenarios are handled :), PR can be reviewed.