cosalib: create libs for s3 and ec2 operations#840
Conversation
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def deregister_ami(ami_id, region): |
There was a problem hiding this comment.
If we're going to grow a lot of these, I think we could auto-generate them. But fine as is now.
There was a problem hiding this comment.
I don't think we'll have more than a few here. If that list grows large ore should be updated instead
There was a problem hiding this comment.
OK, fair enough. And right...this is one of many "mantle vs cosa" issues.
ashcrow
left a comment
There was a problem hiding this comment.
Nits, but functionality looks good 👍
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def deregister_ami(ami_id, region): |
There was a problem hiding this comment.
But we're just wrapping the underlying API call...doesn't seem worth it to copy/paste it or have even more boilerplate docs like "Retry deregister_ami" right?
Feels like we want to generate these.
(On this topic of course, https://www.terraform.io/ is one of several projects implementing a "retry IaaS API calls" pattern)
There was a problem hiding this comment.
Agree, these are just simple wrappers, I don't think its worth adding docstrings there
There was a problem hiding this comment.
This may be more of a personal preference, but having a simple doc with a function tends to be helpful. Keep in mind, this is a nit and isn't required to be updated for merge. I asked @vrutkovs if he's ready for this to merge via chat as I'm happy to hit the button 🙂.
What I hope for is:
"""
Removes an AMI from a specific region.
"""
or even
"""
.. seealso:: :py:func:`ec2.deregister_image`
"""
but your point is well taken @cgwalters.
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def delete_snapshot(snap_id, region): |
| ) | ||
|
|
||
|
|
||
| def download_file(bucket, key, dest): |
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def head_object(bucket, key): |
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def list_objects(bucket, prefix, delimiter="/", result_key='Contents'): |
|
|
||
|
|
||
| @retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
| def delete_object(bucket, key): |
These libraries contain code to work on s3 buckets (head, list, delete) and ec2 (deregister images and snapshots)
|
@vrutkovs noted this is ready for merge. |
|
Will merge post CI run |
These libraries contain code to work on s3 buckets (head, list, delete)
and ec2 (deregister images and snapshots)
Cherrypicked from #839, tested in the dev pipeline