From 7188ae4fe16e16152d38195291ec844299469824 Mon Sep 17 00:00:00 2001 From: Dreamcat4 Date: Mon, 5 Oct 2015 21:53:11 +0100 Subject: [PATCH] fix: The names of firewall profiles are different on win10 & win2008r2 Hi again. This commit removes a small portion of your script's own internal error checking. In specific: for the value of the profile: key. This is essential to avoid errors on other verisons of the windows operating system which are not win2008r2 (your version). For example: on win10 (and most likely win8x too), the names of the profiles don't include the values 'current' and 'all'. But instead the values are 'Public' 'Private' 'Domain' and 'Any. But in addition, there are also certain combinatorial values, such as profile=Public,Private etc. Which is too many to error check yourself. Yet removing the error checking here should not cause any ill effects however: since the netsh advfirewall ... cmds themselves to add / remove / modify actually to their own error checking of the profile=value. So when the cmd is run, it will error out itself with an appropriate / informative error msg. No harm done. Therefore please remove the highlighed portions from your own script. It is essential for interoperability with win10 and win8x. Many thanks. --- lib/ansible/modules/extras/windows/win_firewall_rule.ps1 | 8 +------- lib/ansible/modules/extras/windows/win_firewall_rule.py | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_firewall_rule.ps1 b/lib/ansible/modules/extras/windows/win_firewall_rule.ps1 index 0b0a2cd54f9..8ef2d83aff6 100644 --- a/lib/ansible/modules/extras/windows/win_firewall_rule.ps1 +++ b/lib/ansible/modules/extras/windows/win_firewall_rule.ps1 @@ -246,13 +246,7 @@ foreach ($arg in $args){ }; $winprofile=Get-Attr $params "profile" "current"; -if (($winprofile -ne 'current') -or ($winprofile -ne 'domain') -or ($winprofile -ne 'standard') -or ($winprofile -ne 'all') ) { - $misArg+="Profile"; - $msg+=@("for the Profile parameter only the values 'current', 'domain', 'standard' or 'all' are allowed"); -} else { - - $fwsettings.Add("profile", $winprofile) -} +$fwsettings.Add("profile", $winprofile) if ($($($misArg|measure).count) -gt 0){ $result=New-Object psobject @{ diff --git a/lib/ansible/modules/extras/windows/win_firewall_rule.py b/lib/ansible/modules/extras/windows/win_firewall_rule.py index 295979b248f..ecdec5882cd 100644 --- a/lib/ansible/modules/extras/windows/win_firewall_rule.py +++ b/lib/ansible/modules/extras/windows/win_firewall_rule.py @@ -90,10 +90,10 @@ options: default: null required: false profile: - describtion: + description: - the profile this rule applies to - default: current - choices: ['current', 'domain', 'standard', 'all'] + default: null + required: false force: description: - Enforces the change if a rule with different values exists