-
Notifications
You must be signed in to change notification settings - Fork 26
Fix profile loading when passed an explicit profile #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jtanx
wants to merge
3
commits into
duckdb:v1.4-andium
Choose a base branch
from
jtanx:cf
base: v1.4-andium
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−24
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,9 +44,9 @@ static struct { | |
|
|
||
| //! Parse and set the remaining options | ||
| static void ParseCoreS3Config(CreateSecretInput &input, KeyValueSecret &secret) { | ||
| vector<string> options = {"key_id", "secret", "region", | ||
| "endpoint", "session_token", "endpoint", | ||
| "url_style", "use_ssl", "s3_url_compatibility_mode"}; | ||
| vector<string> options = {"key_id", "secret", "region", | ||
| "endpoint", "session_token", "url_style", | ||
| "use_ssl", "s3_url_compatibility_mode"}; | ||
| for (const auto &val : options) { | ||
| auto set_region_param = input.options.find(val); | ||
| if (set_region_param != input.options.end()) { | ||
|
|
@@ -65,26 +65,25 @@ static unique_ptr<KeyValueSecret> ConstructBaseS3Secret(vector<string> &prefix_p | |
|
|
||
| static Aws::Config::Profile GetProfile(const string &profile_name, const bool require_profile) { | ||
| Aws::Config::Profile selected_profile; | ||
| // get file path where aws credentials are stored. | ||
| // comes from AWS_SHARED_CREDENTIALS_FILE | ||
| auto credentials_file_path = Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename(); | ||
| // get file path where aws config is stored. | ||
| // comes from AWS_CONFIG_FILE | ||
| auto config_file_path = Aws::Auth::GetConfigProfileFilename(); | ||
| // get the profile from within that file | ||
| Aws::Map<Aws::String, Aws::Config::Profile> profiles; | ||
| Aws::Config::AWSConfigFileProfileConfigLoader loader(credentials_file_path); | ||
| Aws::Config::AWSConfigFileProfileConfigLoader loader(config_file_path, true); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe in the future we will want a setting for the |
||
| if (loader.Load()) { | ||
| profiles = loader.GetProfiles(); | ||
| for (const auto &entry : profiles) { | ||
| const Aws::String &profileName = entry.first; | ||
| if (profileName == profile_name) { | ||
| selected_profile = entry.second; | ||
| auto &url = selected_profile.GetValue("endpoint"); | ||
| return selected_profile; | ||
| } | ||
| } | ||
| } | ||
| if (require_profile) { | ||
| throw InvalidConfigurationException("Secret Validation Failure: no profile '%s' found in credentials file %s", | ||
| profile_name, credentials_file_path); | ||
| throw InvalidConfigurationException("Secret Validation Failure: no profile '%s' found in config file %s", | ||
| profile_name, config_file_path); | ||
| } | ||
| return selected_profile; // empty profile | ||
| } | ||
|
|
@@ -313,7 +312,6 @@ static unique_ptr<BaseSecret> CreateAWSSecretFromCredentialChain(ClientContext & | |
| result->secret_map["refresh_info"] = Value::STRUCT(struct_fields); | ||
| } | ||
|
|
||
| AwsSetCredentialsResult ret; | ||
| if (!credentials.IsExpiredOrEmpty()) { | ||
| result->secret_map["key_id"] = Value(credentials.GetAWSAccessKeyId()); | ||
| result->secret_map["secret"] = Value(credentials.GetAWSSecretKey()); | ||
|
|
@@ -356,7 +354,7 @@ void CreateAwsSecretFunctions::InitializeCurlCertificates(DatabaseInstance &db) | |
| struct stat buf; | ||
| if (stat(caFile.c_str(), &buf) == 0) { | ||
| SELECTED_CURL_CERT_PATH = caFile; | ||
| DUCKDB_LOG_DEBUG(db, "aws.CaCertificateDetection", "CA path: %s", SELECTED_CURL_CERT_PATH); | ||
| DUCKDB_LOG_DEBUG(db, "aws.CaCertificateDetection: CA path: %s", SELECTED_CURL_CERT_PATH); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.