saltstack-formulas / shorewall-formula

Saltstack formula for managing shorewall
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
5 stars 21 forks source link

Python3 #17

Closed hwhesselink closed 4 years ago

hwhesselink commented 4 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Python3 dropped iteritems, this PR changes them to items. The only downside to items is that, because it's not a generator, it doesn't handle large dataset well. Given that the changes are for the interfaces and zones files I don't believe that will be an issue.

BTW, the Travis CI check is failing on Wheezy because Debian no longer supports it so the build env. download isn't found.

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

pull-assistant[bot] commented 4 years ago
Score: 1.00

Best reviewed: commit by commit


Optimal code review plan

     Merge pull request #1 from saltstack-formulas/master      change {}.iteritems() to {}.items() for python3      change {}.iteritems() to {}.items() for python3      remove Python version dependency      remove Python version dependency

Powered by Pull Assistant. Last update c879b8f ... 0b63373. Read the comment docs.

hwhesselink commented 4 years ago

I just submitted a PR to remove Wheezy from testing.

Agreed, using dictsort is a cleaner solution, I've updated the PR.

myii commented 4 years ago

Haven't checked this PR in any detail but please be aware of the various issues surrounding |dictsort and .items() here:

hwhesselink commented 4 years ago

Hi @myii, the |dictsort change only applies to the zone and interface names. They are always strings, and the sort order doesn't matter (the previous iteritems and items also don't sort), so I don't think there are issues in this case. I've been using the code in production for a while.

Thanks for merging the "Drop wheezy testing" PR. Travis is still failing with that test atm, do I need to do anything to this PR to update the testing?

myii commented 4 years ago

Hi @myii, the |dictsort change only applies to the zone and interface names. They are always strings, and the sort order doesn't matter (the previous iteritems and items also don't sort), so I don't think there are issues in this case. I've been using the code in production for a while.

@hwhesselink That should be absolutely fine, then. I'll just let @vutny confirm and merge this.

Thanks for merging the "Drop wheezy testing" PR. Travis is still failing with that test atm, do I need to do anything to this PR to update the testing?

You're welcome. There are two ways that we could proceed:

  1. Usually, the contributor can rebase on the latest merged changes and then force push the PR's branch again -- that would avoid the wheezy failure here.
  2. However, since we've already merged that and the other jobs are passing, we can just go ahead and merge this as-is -- they'll pass in the merge commit.

Essentially, don't worry about it in this particular PR but you may need to use option 1 elsewhere.

myii commented 4 years ago

... (the previous iteritems and items also don't sort)

Just a note, as mentioned here, .items() isn't random anymore since around Python 3.6.

hwhesselink commented 4 years ago

@myii, great, I'll wait for the merge.

My original PR actually used .items() but I changed it to use |dictsort based on @vutny's comment earlier in this thread. Both work fine.

After this is merged I'll submit a larger patch to update the formula to work with Shorewall v5.

myii commented 4 years ago

Any final comments, @vutny? Would you mind merging if this is ready to go?

myii commented 4 years ago

Merged, thanks for the PR @hwhesselink and for the review @vutny.