Browse Source

Comment on inconsistency with AWS CLI

Source commit: ffcc06e888a6caa64ba5a08bcb33c1d2d29d9cad
Martin Prikryl 2 years ago
parent
commit
455be1faba
1 changed files with 6 additions and 0 deletions
  1. 6 0
      source/core/S3FileSystem.cpp

+ 6 - 0
source/core/S3FileSystem.cpp

@@ -105,6 +105,9 @@ TStrings * GetS3Profiles()
     while (Index < Result->Count)
     while (Index < Result->Count)
     {
     {
       UnicodeString Section = Result->Strings[Index];
       UnicodeString Section = Result->Strings[Index];
+      // This is not consistent with AWS CLI.
+      // AWS CLI fails if one of AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY is set and other is missing:
+      // "Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY"
       if (S3ConfigFile->ReadString(Section, AWS_ACCESS_KEY_ID, EmptyStr).IsEmpty() &&
       if (S3ConfigFile->ReadString(Section, AWS_ACCESS_KEY_ID, EmptyStr).IsEmpty() &&
           S3ConfigFile->ReadString(Section, AWS_SECRET_ACCESS_KEY, EmptyStr).IsEmpty() &&
           S3ConfigFile->ReadString(Section, AWS_SECRET_ACCESS_KEY, EmptyStr).IsEmpty() &&
           S3ConfigFile->ReadString(Section, AWS_SESSION_TOKEN, EmptyStr).IsEmpty())
           S3ConfigFile->ReadString(Section, AWS_SESSION_TOKEN, EmptyStr).IsEmpty())
@@ -143,6 +146,9 @@ UnicodeString GetS3ConfigValue(const UnicodeString & Profile, const UnicodeStrin
       if (S3ConfigFile.get() != NULL)
       if (S3ConfigFile.get() != NULL)
       {
       {
         UnicodeString AProfile = DefaultStr(Profile, S3Profile);
         UnicodeString AProfile = DefaultStr(Profile, S3Profile);
+        // This is not consistent with AWS CLI.
+        // AWS CLI fails if one of aws_access_key_id or aws_secret_access_key is set and other is missing:
+        // "Partial credentials found in shared-credentials-file, missing: aws_secret_access_key"
         Result = S3ConfigFile->ReadString(AProfile, Name, EmptyStr);
         Result = S3ConfigFile->ReadString(AProfile, Name, EmptyStr);
         if (!Result.IsEmpty())
         if (!Result.IsEmpty())
         {
         {