Permalink
Browse files

do not update IAM session token with error responses

When the connect to sts.amazonaws.com fails, the session token in the
dinerl_data ETS table would be overwritten with the AWS error response.
This fails all subsequest requests and, worse, also prevents
dinerl:update_data/4 to ever succeed again (badmatch on line 253).
  • Loading branch information...
1 parent 0ae35c4 commit 4328897f3cb08b742a5ceb7e4992e6e8a47a7c8c @martinrehfeld committed Sep 16, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/dinerl.erl
View
@@ -262,7 +262,11 @@ update_data(AccessKeyId, SecretAccessKey, Zone, Options) ->
true ->
case iam:get_session_token(AccessKeyId, SecretAccessKey) of
{error, Reason} ->
- {error, Reason};
+ error_logger:warning_msg(
+ "dinerl could not refresh IAM credentials: ~p~n", Reason),
+ {CurrentApiAccessKeyId, CurrentApiSecretAccessKey,
+ Zone, Options, CurrentApiToken, NewDate, CurrentExpirationSeconds};
+
NewToken ->
ExpirationString = proplists:get_value(
expiration, NewToken),

0 comments on commit 4328897

Please sign in to comment.