Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions hadoop-ozone/dist/src/main/smoketest/s3/s3_serviceId.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 S3 gateway test with aws cli
Library OperatingSystem
Library String
Library BuiltIn
Resource ../commonlib.robot
Resource ./commonawslib.robot
Test Timeout 2 minutes
Suite Setup Setup v4 headers
Comment thread
adoroszlai marked this conversation as resolved.
Outdated

*** Keywords ***
Get-secret without om-service-id
${output}= Execute ozone s3 getsecret -u testuser2
Should contain ${output} awsAccessKey
Should contain ${output} awsSecret

Get-secret with om-service-id
${output}= Execute ozone s3 getsecret -u testuser2 ${OM_HA_PARAM}
Should contain ${output} awsAccessKey
Should contain ${output} awsSecret

*** Test Cases ***
S3 without om-service-id
Run Keyword if '${SECURITY_ENABLED}' == 'true' Get-secret without om-service-id

S3 with om-service-id
Run Keyword if '${SECURITY_ENABLED}' == 'true' Get-secret with om-service-id
Comment thread
adoroszlai marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public OzoneClient createClientForS3Commands(
String omServiceID
)
throws IOException, OzoneClientException {
Collection<String> serviceIds = conf.
getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY);
if (omServiceID != null) {
// OM HA cluster
if (OmUtils.isOmHAServiceId(conf, omServiceID)) {
Expand All @@ -195,17 +197,18 @@ public OzoneClient createClientForS3Commands(
throw new OzoneClientException("Service ID specified does not match" +
" with " + OZONE_OM_SERVICE_IDS_KEY + " defined in the " +
"configuration. Configured " + OZONE_OM_SERVICE_IDS_KEY + " are" +
conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
serviceIds);
}
} else {
// If om service id is not specified, consider it as a non-HA cluster.
// But before that check if serviceId is defined. If it is defined
// throw an error om service ID needs to be specified.
if (OmUtils.isServiceIdsDefined(conf)) {
throw new OzoneClientException("Service ID must not"
+ " be omitted when " + OZONE_OM_SERVICE_IDS_KEY + " is defined. " +
"Configured " + OZONE_OM_SERVICE_IDS_KEY + " are " +
conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
// and has length = 1, then take that ID as default.
// otherwise throw an error "om service ID needs to be specified."
Comment thread
Tejaskriya marked this conversation as resolved.
Outdated
if (serviceIds.size() == 1) {
Comment thread
Tejaskriya marked this conversation as resolved.
Outdated
throw new OzoneClientException("Service ID must not"
+ " be omitted when cluster has multiple OM Services." +
" Configured " + OZONE_OM_SERVICE_IDS_KEY + " are "
+ serviceIds);
}
return OzoneClientFactory.getRpcClient(conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public abstract class S3Handler extends Handler {

@CommandLine.Option(names = {"--om-service-id"},
required = false,
description = "OM Service ID is required to be specified for OM HA" +
" cluster")
description = "OM Service ID for OM HA, " +
"required when cluster has multiple OM services")
private String omServiceID;

public String getOmServiceID() {
Expand Down