Skip to content

Commit

Permalink
[fix][fn] TLS args admin download command use zero arity (#20513)
Browse files Browse the repository at this point in the history
### Motivation

#20482 broke the function download command with this error:

```
Expected a command, got false
Usage: pulsar-admin [options] [command] [command options]
  Options:
    --admin-url
      Admin Service URL to which to connect.
      Default: http://localhost:8080/
```

The problem is that the TLS args for hostname verification and for insecure TLS are zero arity, and therefore, we should not add the `false` or the `true` arguments.

### Modifications

* Correct the changes made to the TLS args passed to the `pulsar-admin` CLI tool

### Documentation

- [x] `doc-not-needed`
  • Loading branch information
michaeljmarshall authored Jun 7, 2023
1 parent 0a39b81 commit 50b9a93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,12 @@ && isNotBlank(authConfig.getClientAuthenticationParameters())) {
"--auth-params",
authConfig.getClientAuthenticationParameters()));
}
cmd.addAll(Arrays.asList(
"--tls-allow-insecure",
Boolean.toString(authConfig.isTlsAllowInsecureConnection()),
"--tls-enable-hostname-verification",
Boolean.toString(authConfig.isTlsHostnameVerificationEnable())));
if (authConfig.isTlsAllowInsecureConnection()) {
cmd.add("--tls-allow-insecure");
}
if (authConfig.isTlsHostnameVerificationEnable()) {
cmd.add("--tls-enable-hostname-verification");
}
if (isNotBlank(authConfig.getTlsTrustCertsFilePath())) {
cmd.addAll(Arrays.asList(
"--tls-trust-cert-path",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,6 @@ public void testCustomKubernetesDownloadCommandsWithAuth() throws Exception {
V1StatefulSet spec = container.createStatefulSet();
String expectedDownloadCommand = "pulsar-admin --admin-url " + pulsarAdminUrl
+ " --auth-plugin com.MyAuth --auth-params {\"authParam1\": \"authParamValue1\"}"
+ " --tls-allow-insecure false --tls-enable-hostname-verification false"
+ " functions download "
+ "--tenant " + TEST_TENANT
+ " --namespace " + TEST_NAMESPACE
Expand All @@ -879,7 +878,6 @@ public void testCustomKubernetesDownloadCommandsWithAuthWithoutAuthSpec() throws
V1StatefulSet spec = container.createStatefulSet();
String expectedDownloadCommand = "pulsar-admin --admin-url " + pulsarAdminUrl
+ " --auth-plugin com.MyAuth --auth-params {\"authParam1\": \"authParamValue1\"}"
+ " --tls-allow-insecure false --tls-enable-hostname-verification false"
+ " functions download "
+ "--tenant " + TEST_TENANT
+ " --namespace " + TEST_NAMESPACE
Expand Down Expand Up @@ -909,7 +907,7 @@ public void testCustomKubernetesDownloadCommandsWithAuthAndCustomTLSWithoutAuthS
V1StatefulSet spec = container.createStatefulSet();
String expectedDownloadCommand = "pulsar-admin --admin-url " + pulsarAdminUrl
+ " --auth-plugin com.MyAuth --auth-params {\"authParam1\": \"authParamValue1\"}"
+ " --tls-allow-insecure false --tls-enable-hostname-verification true"
+ " --tls-enable-hostname-verification"
+ " --tls-trust-cert-path /my/ca.pem"
+ " functions download "
+ "--tenant " + TEST_TENANT
Expand Down

0 comments on commit 50b9a93

Please sign in to comment.