cloudyr / aws.signature

Amazon Web Services Request Signatures
https://cloud.r-project.org/package=aws.signature
31 stars 33 forks source link

Credentials has extra `[` #42

Closed muschellij2 closed 5 years ago

muschellij2 commented 5 years ago

Please specify whether your issue is about:

If you are reporting (1) a bug or (2) a question about code, please supply:

Put your code here: I think this has to do with https://github.com/cloudyr/aws.signature/blob/master/R/read_credentials.R#L75 and https://github.com/cloudyr/aws.signature/blob/master/R/read_credentials.R#L86, where you get

#> $default$`[`
#> [1] NA

when you have multiple accounts.

Reproducible Example

library(aws.signature)
x = '[default]
aws_access_key_id = blashasdf
aws_secret_access_key = blashasdf
[new]
aws_access_key_id = blashasdf
aws_secret_access_key = blashasdf'
tfile = tempfile()
writeLines(x, tfile)
aws.signature::read_credentials(tfile)
#> $default
#> $default$AWS_ACCESS_KEY_ID
#> [1] "blashasdf"
#> 
#> $default$AWS_SECRET_ACCESS_KEY
#> [1] "blashasdf"
#> 
#> $default$`[`
#> [1] NA
#> 
#> 
#> $new
#> $new$AWS_ACCESS_KEY_ID
#> [1] "blashasdf"
#> 
#> $new$AWS_SECRET_ACCESS_KEY
#> [1] "blashasdf"
#> 
#> 
#> attr(,"class")
#> [1] "aws_credentials"

Created on 2019-05-09 by the reprex package (v0.2.1)