-
Notifications
You must be signed in to change notification settings - Fork 141
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 for v9.0.0 #128
base: main
Are you sure you want to change the base?
Refactor for v9.0.0 #128
Conversation
a9cb1bb
to
196309b
Compare
3b92322
to
6953438
Compare
I would like this to be reviewed with the thoughts of we will be shortly creating a PR to put this into Chef 17, so I have asked @lamont-granquist as well as @tas50 to review 👍 |
cd06737
to
582968d
Compare
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 appears not to respect the cookbook
property and will always use the template from this cookbook instead of a specified one.
Do we want to keep support for C6 since it is EOL?
property :table, [Symbol, String], | ||
coerce: proc { |p| p.to_sym }, | ||
equal_to: Iptables::Cookbook::Helpers::IPTABLES_TABLE_NAMES, | ||
required: true, | ||
description: 'The table the chain should exist on' |
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.
Was the default of :filter
removed for a reason? We use this default heavily in our wrapper.
We have to keep support for centos6 on this one, just due to chefs customer base and us wanting to put this in core. |
I had some issues with CentOS 6 testing (again!) and wanted to FIO but gathered we'd want to keep it even though it's EoL now. |
Thoughts on the But I'll go with the general concensus, the way I do wrapper cookbooks it doesn't matter much to me either way. |
Hmm i'll check this out but it should do, the only change that will effect it is it'll take the setting from the first resource called (service/chain/rule) as I only initialise the template resource if it doesn't already exist. Might refactor that thinking about it but then it'll come down the last resource declaration so i'm not 100% convinced it's actually better either. |
f657029
to
546dec4
Compare
76fc5be
to
db62e25
Compare
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.
Figured out why our wrapper template was not getting picked up: the cookbook
property needs to be set on the _service
resource, not just on the _chain
and _rule
resources. IMO the _service
resource should not affect the rules template at all since it does not modify it, and let the first _chain
or _rule
call create it.
The examples in the documentation for _service
do not match what is needed for the service to correctly restart when the template changes. The test cookbook has the delayed_action
and manual subscribes
, which are not mentioned as needed in the docs at all and are required to work correctly (at least from my testing). Would having the template resource notify
the service be better, since that way the user does not have to remember to subscribe
to the template?
Is this with the current release version of the cookbook or this PR? This is still a WIP so there may well be things missing/incorrect/will change so bear this in mind if you're attempting to use it. The rulefile template resource is going to be created (and thus take it's source) by the first resource that requires it to exist (via the The trouble with adding notifications to these resources internally is that is hard couples them and removes the benefit of pushing everything into resources and removes flexibility for the implementer in their wrapper. How to do this can be added to the documentation for sure, but the overall idea is someone may choose not to do that with their implementation which is why we try to make these resources as abstract as possible. |
@bmhughes can you please rebase and resolve the conflicts so we can properly review it? |
This was with the current version of this branch.
Ah, I see.
That does make sense, even if that use case is a bit odd. |
Signed-off-by: Ben Hughes <[email protected]>
Signed-off-by: Ben Hughes <[email protected]>
Signed-off-by: Ben Hughes <[email protected]>
Signed-off-by: Ben Hughes <[email protected]>
c8fe094
to
79c8700
Compare
I'm having some trouble with getting the template to restart when the recipe calling node::recipe
- wrapper_resource
- wrapper::recipe
- iptables_service
- iptables_chain/_rule
- iptables_chain/_rule I've created a POC repo that reproduces the problem: https://github.com/detjensrobert/firewall-wrapper-test. Is there something obvious missing with this setup that is preventing the service resource from getting notified? (testing on C7/C8) |
To be perfectly honest (trying not to sound a complete dick here), there's all sorts of things 'wrong' with that cookbook and the patterns it's following so i'm not completely surprised you're having issues and I'd be surprised if they were anything to do with the iptables cookbook itself. I'm using this internally with the same wrapper I've used for the last couple of version without issue and without too many changes so I know it does work in practice. Looking at that example my thoughts are:
|
For constrast, my wrapper contains only a set of recipes that:
Other than those couple of recipes and some methods to set |
Also if someone else has 5 can they try the debian 9/ubuntu 1604/1804 tests locally as they pass for me but fall over on actions. It's going to be related to docker/kernel/modules no doubt. |
Tests pass here in Vagrant & Openstack 👍 |
@bmhughes I can't replicate the current failures but I suspect it's related to a missing iptables kernel module not being loaded on the host system before docker runs. If you add something like the following it can probably give you some additional feedback: |
db402ca
to
7851cef
Compare
@bmhughes Any chance you can get the DCO slapped on here and take a look at the failures in CI? |
fad716d
to
02a5b83
Compare
02a5b83
to
7b64755
Compare
19ec0eb
to
cc494b3
Compare
Description
iptables_packages
toiptables_package
(old name aliased)Issues Resolved
Check List