[ 
https://issues.apache.org/jira/browse/AMBARI-24731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16646430#comment-16646430
 ] 

ASF GitHub Bot commented on AMBARI-24731:
-----------------------------------------

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:
us...@infra.apache.org


> Infra Manager: scheduled cleanup of old jobs
> --------------------------------------------
>
>                 Key: AMBARI-24731
>                 URL: https://issues.apache.org/jira/browse/AMBARI-24731
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-infra
>    Affects Versions: 2.8.0
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.8.0
>
>
> Infra manager should have a mechanism, which can be scheduled (like every day 
> once), to check against old job history and get rid of them (if the job 
> already finished about 7 days, it can be deleted -> all references in the db)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to