This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new baf82d8380 HDDS-9313. Make OM service ID optional for `ozone admin om 
fetch-key` if only one is defined in config (#5340)
baf82d8380 is described below

commit baf82d8380439be467e2612ef500f25d655fd931
Author: Pratyush Bhatt <[email protected]>
AuthorDate: Fri Sep 22 20:14:27 2023 +0530

    HDDS-9313. Make OM service ID optional for `ozone admin om fetch-key` if 
only one is defined in config (#5340)
---
 .../dist/src/main/compose/ozonesecure-ha/test.sh   |  2 +
 .../src/main/smoketest/omha/om-fetch-key.robot     | 53 ++++++++++++++++++++++
 .../hadoop/ozone/admin/om/FetchKeySubCommand.java  |  2 +-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test.sh 
b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test.sh
index f6ab69746c..09c65c445c 100755
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test.sh
@@ -52,6 +52,8 @@ done
 
 execute_robot_test s3g admincli
 
+execute_robot_test s3g omha/om-fetch-key.robot
+
 execute_robot_test s3g omha/om-leader-transfer.robot
 
 execute_robot_test s3g httpfs
diff --git a/hadoop-ozone/dist/src/main/smoketest/omha/om-fetch-key.robot 
b/hadoop-ozone/dist/src/main/smoketest/omha/om-fetch-key.robot
new file mode 100644
index 0000000000..e40e53117a
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/omha/om-fetch-key.robot
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation       Smoke test for om fetch-key
+Library             OperatingSystem
+Resource            ../commonlib.robot
+Test Timeout        5 minute
+Suite Setup         Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Kinit 
test user     testuser     testuser.keytab
+
+
+*** Variables ***
+
+
+*** Keywords ***
+
+
+*** Test Cases ***
+Fetch Key with Valid ServiceID Specified
+    ${result} =              Execute                        ozone admin om 
fetch-key --service-id=omservice
+    Should Contain           ${result}                      Current Secret Key 
ID
+
+Fetch Key with Multiple ServiceIDs, Valid ServiceID Specified
+    ${result} =              Execute                        ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om fetch-key 
--service-id=omservice
+    Should Contain           ${result}                      Current Secret Key 
ID
+
+Fetch Key with Multiple ServiceIDs, Unconfigured ServiceID Specified
+    ${result} =              Execute And Ignore Error       ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om fetch-key 
--service-id=omservice3
+    Should Contain           ${result}                      Service ID 
specified does not match
+
+Fetch Key with Multiple ServiceIDs, Invalid ServiceID Specified
+    ${result} =              Execute And Ignore Error       ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om fetch-key 
--service-id=omservice2
+    Should Contain           ${result}                      Could not find any 
configured addresses for OM.
+
+Fetch Key without OM Service ID
+    ${result} =              Execute                        ozone admin om 
fetch-key
+    Should Contain           ${result}                      Current Secret Key 
ID
+
+Fetch Key with Multiple ServiceIDs, No ServiceID Specified
+    ${result} =              Execute And Ignore Error       ozone admin 
--set=ozone.om.service.ids=omservice,ozone1 om fetch-key
+    Should Contain           ${result}                      no Ozone Manager 
service ID specified
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/FetchKeySubCommand.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/FetchKeySubCommand.java
index ba0220292c..55349a67c4 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/FetchKeySubCommand.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/FetchKeySubCommand.java
@@ -40,7 +40,7 @@ public class FetchKeySubCommand implements Callable<Void> {
   @CommandLine.Option(
       names = {"-id", "--service-id"},
       description = "Ozone Manager Service ID",
-      required = true
+      required = false
   )
   private String omServiceId;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to