Skip to content
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

Fix for iptables states fail when state_aggregate option is enabled #54081

Closed
wants to merge 20 commits into from

Conversation

xeacott
Copy link
Contributor

@xeacott xeacott commented Jul 31, 2019

What does this PR do?

Add method to remove circular references to objects that must be decoded/encoded.

What issues does this PR fix or reference?

Fix #53353 by cleaning data object in case of circular references.

Tests written?

Yes

Commits signed with GPG?

No

@xeacott xeacott requested a review from a team as a code owner July 31, 2019 18:41
@ghost ghost requested a review from twangboy July 31, 2019 18:41
@xeacott xeacott changed the title Issue/53353 Fix for iptables states fail when state_aggregate option is enabled Jul 31, 2019
@xeacott
Copy link
Contributor Author

xeacott commented Jul 31, 2019

Forgot to squash when I merged 👎

@waynew
Copy link
Contributor

waynew commented Jul 31, 2019

I'm not entirely sure that I like just removing circular refs. I mean, it probably solves the problem, but it obscures the fact that we shouldn't be creating circular data structures in the first place. At least, I'm not aware of any place in salt where that would be a good thing to have 🤷‍♂

@xeacott
Copy link
Contributor Author

xeacott commented Jul 31, 2019

I agree. This just puts in a fail safe that if we do have a circular reference, clean it up and let it pass through. However, I'm not entirely sure where an object would have gained a circular reference, which would be the real root cause. I can investigate it further for sure!

@waynew
Copy link
Contributor

waynew commented Jul 31, 2019

I've noticed that we have occasions where this is the case. I wouldn't be opposed to putting this PR in if we also logged (probably as an error, probably with the stack trace?) that a circular reference was detected, asking users to report it.

At least, I don't think I would 😂

@xeacott
Copy link
Contributor Author

xeacott commented Jul 31, 2019

Let me find the correct place to log and I'll get that in with this PR!
And fix lint.

test_list = {'foo': [],}
test_list['foo'].append((test_list,))
ret = salt.utils.data._remove_circular_refs(ob=test_list)
self.assertDictEqual(ret, {'foo': [(None,)]})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is failing lint. You need a space after the comma.

@xeacott xeacott closed this Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants