You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by GitBox <gi...@apache.org> on 2018/10/11 13:38:53 UTC

[GitHub] oleewere commented on a change in pull request #4: AMBARI-24731 - Infra Manager: scheduled cleanup of old jobs

oleewere commented on a change in pull request #4: AMBARI-24731 - Infra Manager: scheduled cleanup of old jobs
URL: https://github.com/apache/ambari-infra/pull/4#discussion_r224450545
 
 

 ##########
 File path: ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java
 ##########
 @@ -48,14 +64,29 @@ public S3Uploader(S3Properties s3Properties, PasswordStore passwordStore) {
     if (isNotBlank((s3Properties.getS3AccessFile())))
       compositePasswordStore = new CompositePasswordStore(passwordStore, S3AccessCsv.file(s3Properties.getS3AccessFile()));
 
-    BasicAWSCredentials credentials = new BasicAWSCredentials(
-            compositePasswordStore.getPassword(S3AccessKeyNames.AccessKeyId.getEnvVariableName())
-                    .orElseThrow(() -> new IllegalArgumentException("Access key Id is not present!")),
-            compositePasswordStore.getPassword(S3AccessKeyNames.SecretAccessKey.getEnvVariableName())
-                    .orElseThrow(() -> new IllegalArgumentException("Secret Access Key is not present!")));
-    client = new AmazonS3Client(credentials);
-    if (!isBlank(s3Properties.getS3EndPoint()))
-      client.setEndpoint(s3Properties.getS3EndPoint());
+    try {
+      client = new MinioClient(s3Properties.getS3EndPoint(), compositePasswordStore.getPassword(S3AccessKeyNames.AccessKeyId.getEnvVariableName())
+              .orElseThrow(() -> new IllegalArgumentException("Access key Id is not present!")),
+              compositePasswordStore.getPassword(S3AccessKeyNames.SecretAccessKey.getEnvVariableName())
+                      .orElseThrow(() -> new IllegalArgumentException("Secret Access Key is not present!")));
+
+      if (!client.bucketExists(bucketName))
+        client.makeBucket(bucketName);
+
+    } catch (RegionConflictException | XmlPullParserException | InvalidBucketNameException | NoSuchAlgorithmException | InsufficientDataException | ErrorResponseException | InvalidKeyException | NoResponseException | InvalidPortException | InvalidEndpointException | InternalException e) {
+      throw new RuntimeException(e);
+    } catch (IOException e) {
+      throw new UncheckedIOException(e);
+    }
+
+//    BasicAWSCredentials credentials = new BasicAWSCredentials(
 
 Review comment:
   remove this

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services