Skip to content

Commit

Permalink
Revert "Revert "init: fix S3 ARN parsing aws#617""
Browse files Browse the repository at this point in the history
This reverts commit 760bfed.
  • Loading branch information
PettitWesley committed Apr 11, 2023
1 parent 3a981c1 commit 37e2ea9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions init/fluent_bit_init_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,20 @@ func processConfigFile(path string) {
}
}

func getS3ConfigFile(arn string) string {
func getS3ConfigFile(userInput string) string {
// Preparation for downloading S3 config files
if !s3ClientCreated {
createS3Client()
}

// e.g. "arn:aws:s3:::user-bucket/s3_parser.conf"
arnBucketFile := arn[13:]
bucketAndFile := strings.SplitN(arnBucketFile, "/", 2)
s3ARN, err := arn.Parse(userInput)
if err != nil {
logrus.Fatalf("[FluentBit Init Process] Could not parse arn: %s\n", userInput)
}
bucketAndFile := strings.SplitN(s3ARN.Resource, "/", 2)
if len(bucketAndFile) != 2 {
logrus.Fatalf("[FluentBit Init Process] Unrecognizable arn: %s\n", arn)
logrus.Fatalf("[FluentBit Init Process] Could not parse arn: %s\n", userInput)
}

bucketName := bucketAndFile[0]
Expand Down

0 comments on commit 37e2ea9

Please sign in to comment.