Skip to content

Commit

Permalink
Fix profile issue
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Dwyer <[email protected]>
  • Loading branch information
bdwyertech committed Jun 2, 2018
1 parent 34eb88e commit 945a40b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/vagrant-aws/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,25 +525,17 @@ def get_aws_info(profile, location)
private

def read_aws_files(profile, aws_config, aws_creds)
# determine section in config ini file
if profile == 'default'
ini_profile = profile
else
ini_profile = 'profile ' + profile
end
# get info from config ini file for selected profile
data = File.read(aws_config)
doc_cfg = IniParse.parse(data)
aws_region = doc_cfg[ini_profile]['region']
aws_region = doc_cfg[profile]['region']

# determine section in credentials ini file
ini_profile = profile
# get info from credentials ini file for selected profile
data = File.read(aws_creds)
doc_cfg = IniParse.parse(data)
aws_id = doc_cfg[ini_profile]['aws_access_key_id']
aws_secret = doc_cfg[ini_profile]['aws_secret_access_key']
aws_token = doc_cfg[ini_profile]['aws_session_token']
aws_id = doc_cfg[profile]['aws_access_key_id']
aws_secret = doc_cfg[profile]['aws_secret_access_key']
aws_token = doc_cfg[profile]['aws_session_token']

return aws_region, aws_id, aws_secret, aws_token
end
Expand Down

0 comments on commit 945a40b

Please sign in to comment.