-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Refactor iptables #20593
Refactor iptables #20593
Conversation
@thusoy, it looks like there are some test failures. |
565112f
to
7ae9b2c
Compare
It does indeed, fixed that and the pylint error and rebased, let's see what jenkins has to say now. |
@thusoy, sorry for all the trouble but there were some changes to iptables.py recently that were not included in your rebase. Will you fetch and rebase on develop again? Thanks. |
7ae9b2c
to
9f6dfb5
Compare
@jfindlay Sure thing, no probs. There's still the questions raised in the first post, any opinion on any of those? |
@thusoy I can answer a couple of your initial questions. Raising exceptions can be tricky here, because they might get silently caught before they reach the user. Error strings will always reach the user. That said, I'm open to any suggestions that @jfindlay may have here. Defaulting table to Thanks for the cleanup. I haven't had a chance to peruse it as thoroughly as I'd like, but offhand it looks much nicer. |
I am still a novice in this and many other areas of the salt codebase. Consistency in output and return codes for modules is something that is going to happen in the next release or two. In the mean time, getting an error string back to the point of action is going to be better than raising an exception, as @techhat has already mentioned. Iptables is difficult to state by its very nature. Any good ideas you can bring to that are most welcome. |
Should I include the |
@thusoy, it's up to you. I think it would be simpler and easier to do that here, but if you have a reason to submit a change for that later, that would be fine. |
@jfindlay Okay, I set the default to 'filter', this is ready to merge as far as I'm concerned. As for the idea about tracking SALT_ID in the comment field, I think it would work well for platforms where comments are supported, but not all iptables supports this (notably RedHat/CentOS). It could perhaps be used where supported and let non-supported platforms live with todays behavior, hoping they'll eventually catch up. |
Missed a test case... |
Adds some tests and support for --log-* arguments.
Also stops writing to error log for the checks (
iptables -C
), since it's not really a failure.And most importantly, makes the module much more readable.
Some questions:
build_rule
function returns strings on errors ("Error: Table needs to be specified"), is is better if this raises an exception instead?table
argument tobuild_rule
defaults toNone
, wouldn't it be simpler for this to default to'filter'
, and thus not require that to be specified everywhere? (That would also close iptables.set_pocity KeyError: 'table' ubuntu 14.04 #18745)