Merge pull request #1542 from hashicorp/aws-ec2-identity-nil-check

aws-ec2: added a nil check for storedIdentity in login renewal
This commit is contained in:
Vishal Nayak 2016-06-20 10:51:16 -04:00 committed by GitHub
commit 5772c21ef0

View File

@ -501,13 +501,16 @@ func (b *backend) pathLoginRenew(
// Cross check that the instance is still in 'running' state
_, err := b.validateInstance(req.Storage, instanceID, region)
if err != nil {
return nil, fmt.Errorf("failed to verify instance ID: %s", err)
return nil, fmt.Errorf("failed to verify instance ID '%s': %s", instanceID, err)
}
storedIdentity, err := whitelistIdentityEntry(req.Storage, instanceID)
if err != nil {
return nil, err
}
if storedIdentity == nil {
return nil, fmt.Errorf("failed to verify the whitelist identity entry for instance ID: %s", instanceID)
}
// Ensure that role entry is not deleted.
roleEntry, err := b.lockedAWSRole(req.Storage, storedIdentity.Role)