-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fair enough. And right...this is one of many "mantle vs cosa" issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, these are just simple wrappers, I don't think its worth adding docstrings there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
) | ||
|
||
|
||
def download_file(bucket, key, dest): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
|
||
|
||
@retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
def head_object(bucket, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
|
||
|
||
@retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
def list_objects(bucket, prefix, delimiter="/", result_key='Contents'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
|
||
|
||
@retry(stop=retry_stop, retry=retry_boto_exception, before_sleep=retry_callback) | ||
def delete_object(bucket, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missing docstring
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