-
Notifications
You must be signed in to change notification settings - Fork 87
Fix for cache bug in s3fs #812
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
Conversation
@@ -575,6 +575,10 @@ def _read_buckets_cache_file(cache_file): | |||
with salt.utils.files.fopen(cache_file, 'rb') as fp_: | |||
try: | |||
data = pickle.load(fp_) | |||
# check for 'corrupted' cache data ex: {u'base':[]} | |||
if not list(filter(None, data.values())): |
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.
list(filter())
please.
Isn't it enough to say
if not data.get('base'):
data = None
Or at the very least, something like
if not any(data.values()):
data = None
It's a nit-pick for sure, but ...
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.
Last one will work just fine I believe. First one won't since saltenv won't always be base and it doesn't cover the use case of having multiple saltenvs {u'base': [], u'testing':[{u'somedict':[]}]}
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 really hope people aren't using saltenv in their hubble ... it doesn't work very well in salt. It sure as heck won't work in hubble. I think the whole reference to 'base' is vestigial in this context. But whatever. As long as we're not using filter()
and forcing our iterator down to a list()
, we'll be fine.
@daveed12, for documentation sake, any comments on how this was tested and some elaboration on what situation does this fix? |
To be merged to 3.0 and 4.0. |
That's the BackFeature label in this case. applied. |
Oh, wait, this is against develop... It should be against 3.0 branch... |
So I put BackFeature (to 4.0) and To Backport (to 3.0) |
Handles cached data correctly for s3fs if non 2XX response occurs.