Nothing Special   »   [go: up one dir, main page]

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

(MODULES-8214) Handle src_type and dst_type as array #790

Conversation

mateusz-gozdek-sociomantic

So it can be parsed when specified mutliple times, as well as being configured.

Perhaps acceptance tests are missing for it, I'll try add them soon.

@@ -503,6 +517,8 @@ def self.rule_to_hash(line, table, counter)
end

hash[:ipset] = hash[:ipset].split(';') unless hash[:ipset].nil?

Choose a reason for hiding this comment

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

I'll actually improve this part.

@mateusz-gozdek-sociomantic mateusz-gozdek-sociomantic force-pushed the MODULES-8214-multiple-src-dst-type branch 2 times, most recently from 988b907 to f1a7ef9 Compare November 8, 2018 16:16
@mateusz-gozdek-sociomantic
Copy link
Author

Simplified code a bit, improved documentation, tests and added some acceptance tests.

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Your changes are currently showing syntax errors. To view them locally you just have to run the command:

bundle exec rubocop

If you add a -a to the end of the command it will even autocorrect some of them.

@mateusz-gozdek-sociomantic
Copy link
Author

@david22swan are you sure you're checking latest commit? I was running bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop (the same as CI is running) and everything was fine...

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic I honestly have no idea, it's disappeared now. Must have been an old commit. Sorry
Also there's gonna be a wait on your pr getting merged, the pipelines for testing are down right now.

@mateusz-gozdek-sociomantic
Copy link
Author
mateusz-gozdek-sociomantic commented Nov 14, 2018

Any updates on this? I was wondering, maybe I should also add it to changelog, that it will be reported as array now. And I'm wondering if that's a breaking change or not...

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Unfortunately the pipelines are still down right know.
As to your comments, a docs change would be good, to let people know of the expanded functionality. And regarding it being a breaking change, is anything changed about the output if you were to use your updated code in the same manner as before you had altered it, if that it understandable.
i.e. Can you still use the code in the same way as before without any alterations? Or do you need to update your manifest's for it?

@mateusz-gozdek-sociomantic
Copy link
Author

The code and manifests should be fine, since we cast string to array now. The only thing which comes to my mind is, that if someone use output of puppet resource firewall, that changes, since it's reporting array now and not string. I'm not sure how changelogs are generated, but perhaps it could be mentioned there.

I've noticed, that I should also update README.markdown, so I'll do it now.

@mateusz-gozdek-sociomantic
Copy link
Author

Ping @david22swan :)

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Apologies on the wait, was moved onto some new work and lost track of everything, I am running your changes through the pipeline right now, and assuming all goes well, I should get your work merged in either today or tomorrow.
Again, sorry for the wait.

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic I'm sorry, but unfortunatly the following test's have failed against both redhat 5 and centos 5 when run on puppet 6:

07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:10:5:2]' # firewall basics dst_type when LOCAL --limit-iface-in fail does not contains the rule
07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:10:7:1]' # firewall basics dst_type when mutliple addrtype applies
07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:10:7:2]' # firewall basics dst_type when mutliple addrtype contains the rule
07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:11:5:2]' # firewall basics src_type when LOCAL --limit-iface-in fail does not contains the rule
07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:11:7:1]' # firewall basics src_type when mutliple addrtype applies
07:58:38 rspec './spec/acceptance/firewall_spec.rb[1:11:7:2]' # firewall basics src_type when mutliple addrtype contains the rule

The error message looks the same as on your last pr, so hopefully it can be dealt with in the same way.

@mateusz-gozdek-sociomantic
Copy link
Author

I'll do some tests and patch it tomorrow.

@mateusz-gozdek-sociomantic
Copy link
Author

Okay, so:

  • Fixed 's/mutliple/multiple/g' 🤦‍♂️
  • Checked on CentOS 5, it seems that in iptables 1.3.7, you can't specify src_type and dst_type multiple times, so added a check for it, which throws exception and adapted spec.
  • Changed expection message from "not supported in your version" to "supported from version", as I believe it's more helpful for end users. Other messages could be adopted to that too, but I didn't touch it.

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Unfortunately that only fixed two of the failures, four of them still remain:

06:39:15 rspec './spec/acceptance/firewall_spec.rb[1:10:6:1]' # firewall basics dst_type when duplicated LOCAL fails
06:39:15 rspec './spec/acceptance/firewall_spec.rb[1:10:8:1]' # firewall basics dst_type when multiple addrtype fail fails
06:39:15 rspec './spec/acceptance/firewall_spec.rb[1:11:6:1]' # firewall basics src_type when duplicated LOCAL fails
06:39:15 rspec './spec/acceptance/firewall_spec.rb[1:11:8:1]' # firewall basics src_type when multiple addrtype fail fails

I've created a gist containing the failure output so you can get a better look:
https://gist.github.com/david22swan/106262f240723700ffa7aaf90b0ff865

@mateusz-gozdek-sociomantic
Copy link
Author
  • Fixed regexes for firewall basics dst_type when multiple addrtype fail fails, There was #, which shouldn't be there I believe
  • firewall basics src_type when duplicated LOCAL fails disabled this test on CentOS 5, as we throw multiple addrtype first, not sure if that's the best choice

@mateusz-gozdek-sociomantic
Copy link
Author

Just out of curiosity, is there a way to run this pipeline locally? I tried with vagrant, but it's difficult to set up. It would definitely speed up the process :)

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Still failing the following test's on both sorry:

02:01:04 rspec './spec/acceptance/firewall_spec.rb[1:10:8:1]' # firewall basics dst_type when multiple addrtype fail fails
02:01:04 rspec './spec/acceptance/firewall_spec.rb[1:11:8:1]' # firewall basics src_type when multiple addrtype fail fails

And unfortunately you an't access are pipelines, the vmpooler images that we use are private to the company and can't be accessed by anyone outside of it.

So it can be parsed when specified mutliple times, as well as being configured.
@mateusz-gozdek-sociomantic
Copy link
Author

Ugh, match reges was using test variable, not type`, I have no idea where this came from. Anyway, I fixed it. Let's hope it works this time 🤞

@david22swan
Copy link
Member

🤞

@david22swan
Copy link
Member

screen shot 2018-11-26 at 5 02 03 pm

@david22swan
Copy link
Member

@mateusz-gozdek-sociomantic Adoc went green :).
Happy to merge!
Thanks for your work.

@david22swan david22swan merged commit 551032a into puppetlabs:master Nov 26, 2018
@mateusz-gozdek-sociomantic mateusz-gozdek-sociomantic deleted the MODULES-8214-multiple-src-dst-type branch November 26, 2018 17:15
@mateusz-gozdek-sociomantic
Copy link
Author

Awesome, thanks for your patient!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants