-
Notifications
You must be signed in to change notification settings - Fork 88
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 xFirewall if CIDR notation used for LocalAddress/RemoteAddress - Fixes #169 #173
Fix xFirewall if CIDR notation used for LocalAddress/RemoteAddress - Fixes #169 #173
Conversation
@tysonjhayes - I'm thinking this one will need some fixing up before it can be merged once your PR #174 goes through. So no need to rush out a review on this till after then. |
Reviewed 3 of 14 files at r1, 1 of 1 files at r2. Tests/Unit/MSFT_xFirewall.Tests.ps1, line 622 at r2 (raw file):
This will need an override at the top of the file as we're not supposed to use invoke-expression, however, I'm not really sure how else to get around that rule. Comments from Reviewable |
Review status: 4 of 13 files reviewed at latest revision, 2 unresolved discussions. Tests/Integration/MSFT_xFirewall_add.config.ps1, line 45 at r2 (raw file):
I might be missing something but where is the node variable defined? Comments from Reviewable |
Review status: 4 of 13 files reviewed at latest revision, 4 unresolved discussions. DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 6 at r2 (raw file):
I know we're holding off on final paths until I merge in my thing, but I noted SharePoint has a \SharepointDsc\Modules directory that I think this would be a better fit under, so it kind of cleanly encapsulates everything. DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 16 at r2 (raw file):
See above on path. Comments from Reviewable |
Review status: 0 of 15 files reviewed at latest revision, 4 unresolved discussions. Tests/Integration/MSFT_xFirewall_add.config.ps1, line 45 at r2 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
$Node is a variable that automatically gets exposed by the Comments from Reviewable |
Review status: 0 of 15 files reviewed at latest revision, 4 unresolved discussions. Tests/Unit/MSFT_xFirewall.Tests.ps1, line 622 at r2 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
I gave this a try, but unfortunately, suppressing the rule actually violates some of the standard tests. We can only suppress certain rules and this isn't one of them 😢 So, we might have to leave the warning here and figure out a way to address rewrite the code as part of issue #166. DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 6 at r2 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
Done. DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 16 at r2 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
Done. Comments from Reviewable |
@tysonjhayes - this is what happens when I try and suppress the rule: |
I get the intent of that test but I'm not sure I agree with it. I guess we just take the warning for now... Reviewed 3 of 23 files at r1, 11 of 22 files at r3, 12 of 12 files at r4. DSCResource.Tests, line 1 at r4 (raw file):
What's the deal with this? Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 120 at r4 (raw file):
So because of the merge we took with my changes I believe the help is auto generated from the mof files, do we still need this here? Modules/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1, line 4 at r4 (raw file):
Should all of these be tabed over? Modules/xNetworking/Examples/Resources/xFirewall/2-xFirewall_AddFirewallRule_AllParameters.ps1, line 20 at r4 (raw file):
Any reason we're going back to double quotes? Tests/Integration/MSFT_xFirewall_remove.config.ps1, line 2 at r4 (raw file):
Just curious, are we creating .ps1 for every config rule? I always figured one file with all of the rules made sense, and allowed us to load the file once instead of before every rule. Comments from Reviewable |
I know what you mean. I guess there are going to have to be exceptions to this test though - unless we can find a different way of writing the code. @kwirkykat - does your team have any thoughts on this? The issue is that we're using Invoke-Expression to allow the large number of parameters in the Firewall to be stored in a PSD1 data structure and processed by various loops instead of writing a whole lot of code. We haven't got an alternative to using Invoke-Expression for this code. But we can't suppress the message. Perhaps you guys have got some ideas on what we might replace it with? Review status: all files reviewed at latest revision, 5 unresolved discussions. DSCResource.Tests, line 1 at r4 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
Er um. I'm not sure how that got there? Possibly turned up when I was working on fixing the merge conflicts and figuring out how to test the repo with the new layout. It shouldn't be there though - good catch. Removed. Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 120 at r4 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
This is one of the many requirements of HQRM 😁 I think it does help though because it does enable a bit of extra detail in intellisense when writing DSC Configs. Modules/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1, line 4 at r4 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
Yes - it should. Done. Modules/xNetworking/Examples/Resources/xFirewall/2-xFirewall_AddFirewallRule_AllParameters.ps1, line 20 at r4 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
Nope. I fixed it. Sorry about that! Tests/Integration/MSFT_xFirewall_remove.config.ps1, line 2 at r4 (raw file): Previously, tysonjhayes (Tyson J. Hayes) wrote…
I've tweaked this a bit by moving the $Rule into the $ConfigData object which gets passed to the Configs. I probably could have just used a single config and just passed a $ConfigData with different node properties. I just felt it was cleaner separating them (and that was the design pattern I'd used elsewhere - see xPSDesiredStateConfiguration). But happy to change it if you think it's better that way? Comments from Reviewable |
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.
LGTM
Reviewed 1 of 23 files at r1, 1 of 22 files at r3, 6 of 6 files at r5. Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1, line 120 at r4 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
I'm more thinking I'm not seeing that on SharePointDsc for example, and it would mean we have documentation for the functions in two different places (mof file and the ps1) which could lead to discrepancies on the documentation. I'm not sure IN THE FILE is necessary, as long as the help is present (which we do on build). Tests/Integration/MSFT_xFirewall_remove.config.ps1, line 2 at r4 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Honestly I'm not sure which I would prefer, let's leave it this way for now. Comments from Reviewable |
The primary purpose for this PR is to fix issue #169. In fixing this I also uncovered a bug in the Integration tests for xFirewall that resulted in the firewall rule properties not actually being tested after the rule was set. Fixing this didn't actually identify any test failures.
However, I've also begun work on the resource to bring it up to HQRM (issue #135) and added the CommonResourceHelper.psm1 module (issue #152).
The detailed list of changes are as follows:
This change is