forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pulsar-admin] New option takes precedence over deprecated option (ap…
…ache#12260) ### Motivation Currently, we use new option to replace some deprecated option in client-tools. for example: pulsar/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java ```java @parameter(names = "--brokerServiceUrl", description = "The URL for the Pulsar broker", hidden = true) protected String DEPRECATED_brokerServiceUrl; @parameter(names = "--broker-service-url", description = "The URL for the Pulsar broker") protected String brokerServiceUrl; ``` In order to maintain compatibility, the deprecated option still take effect through merging, as below: pulsar/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java ```java private void mergeArgs() { if (!isBlank(DEPRECATED_brokerServiceUrl)) brokerServiceUrl = DEPRECATED_brokerServiceUrl; if (!isBlank(DEPRECATED_clientAuthPlugin)) clientAuthPlugin = DEPRECATED_clientAuthPlugin; if (!isBlank(DEPRECATED_clientAuthParams)) clientAuthParams = DEPRECATED_clientAuthParams; if (DEPRECATED_useTls != null) useTls = DEPRECATED_useTls; if (DEPRECATED_tlsAllowInsecureConnection != null) tlsAllowInsecureConnection = DEPRECATED_tlsAllowInsecureConnection; if (DEPRECATED_tlsHostNameVerificationEnabled != null) tlsHostNameVerificationEnabled = DEPRECATED_tlsHostNameVerificationEnabled; if (!isBlank(DEPRECATED_tlsTrustCertFilePath)) tlsTrustCertFilePath = DEPRECATED_tlsTrustCertFilePath; } ``` But I found that its priority is higher than the new option, which causes the new option to be invalid when we set both at the same time. ### Modifications Adjust the priority of the new and deprecated option, the deprecated option only takes effect when the new option is not set.
- Loading branch information
Showing
3 changed files
with
169 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters