Skip to content

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

Merged
merged 1 commit into from
Feb 27, 2020
Merged

Conversation

daveed12
Copy link
Contributor

Handles cached data correctly for s3fs if non 2XX response occurs.

@@ -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())):
Copy link
Contributor

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 ...

Copy link
Contributor Author

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':[]}]}

Copy link
Contributor

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.

@fossam
Copy link
Contributor

fossam commented Feb 27, 2020

@daveed12, for documentation sake, any comments on how this was tested and some elaboration on what situation does this fix?
I'm sure it has been communicated in other channels, just want to make sure it is also explained here.

@fossam
Copy link
Contributor

fossam commented Feb 27, 2020

To be merged to 3.0 and 4.0.

@jettero jettero added the BackFeature TODO: merge forward to develop label Feb 27, 2020
@jettero
Copy link
Contributor

jettero commented Feb 27, 2020

To be merged to 3.0 and 4.0.

That's the BackFeature label in this case. applied.

@jettero
Copy link
Contributor

jettero commented Feb 27, 2020

Oh, wait, this is against develop... It should be against 3.0 branch...

@jettero
Copy link
Contributor

jettero commented Feb 27, 2020

So I put BackFeature (to 4.0) and To Backport (to 3.0)

@jettero jettero merged commit 54062cf into hubblestack:develop Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants