edurange / edurange-server

cloud-based interactive security exercises
https://www.edurange.org
MIT License
14 stars 14 forks source link

Remove aws_call method. #56

Closed newjam closed 5 years ago

newjam commented 5 years ago

In aws_provider.rb there is a function aws_call whose purpose is retry a method if it fails.

https://github.com/edurange/edurange-server/blob/5e2afa48ae563fa82aeca7a1162851fd0c405a94/app/models/concerns/provider_aws.rb#L502-L519

I'm not sure it's wise to try a function again if it is a logical exception. If it is a network connectivity exception or a request limit exception, the aws sdk will retry requests on its own using the max_retries option.

This method and its use clutters up the code by requiring all methods be called using something like https://github.com/edurange/edurange-server/blob/5e2afa48ae563fa82aeca7a1162851fd0c405a94/app/models/concerns/provider_aws.rb#L489 Instead of the simpler

object = aws_S3_object_get(bucket: bucket, name: name) 

At the very least, we can implement this functionality as a decorator. Something like at the class level

aws_call :aws_S3_object_get

Then which wraps the underlying method with this functionality.

newjam commented 5 years ago

Removed in commit https://github.com/edurange/edurange-server/commit/981bf53603034674861ca0570c69684bb5bc7337 . Instead provisioning and configuring is done using terraform.