sous-chefs/iis

Unable to add new element to a Collection

Opened this issue · 3 comments

Cookbook version

7.1.0

Chef-client version

14.5.33

Platform Details

Windows Server 2012R2

Scenario:

Add an element to Collection under verbs in system.webServer/security/requestFiltering section

Equivalent PowerShell command:
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/security/requestFiltering/verbs" -name "." -value @{verb='TRACE';allowed='False'}

Steps to Reproduce:

Run this Recipe:

iis_config_property 'Add HTTP Trace Method' do
  ps_path   'MACHINE/WEBROOT/APPHOST'
  filter    'system.webServer/security/requestFiltering/verbs'
  property  'verb'
  value     'TRACE'
  action    :add
end
iis_config_property 'Set HTTP Trace Method to false' do
  ps_path   'MACHINE/WEBROOT/APPHOST'
  filter    "system.webServer/security/requestFiltering/verbs/add[@verb='TRACE']"
  property  'allowed'
  value     'false'
end

Expected Result:

Should add a new element (verb='TRACE',allowed='False' under verbs

Actual Result:

Error Log can be found here: errorlog

Hey There
It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you.
Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.

I think the issue is while adding the verb property, I need to set two mandatory properties at same time. i.e In my first recipe, I have to add both verb & allowed property together. If I am correct, Is this possible?

We actually came across this issue this week as well. We were trying to execute an Add-WebConfigurationProperty command similar to what is shown below and the iis_config_property resource did not support multiple properties for the value parameter:

Add-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location "FTP Site"`
-Filter "/system.ftpServer/security/authorization" -Name "."`
-Value @{accessType='Allow';users='FTP User';permissions='Read, Write'} 

I opened PR-435 in an attempt to resolve this issue, and looking for any feedback or suggestions.