Open flkdnt opened 1 year ago
@flkdnt thanks for raising this. We are accepting PRs to this repo, so if you want to implement your proposed changes feel free to do so. Otherwise I'll label this issue so It can be prioritised correctly by our team :-) Thanks again.
Bug Report
Describe the Bug
When Creating or Updating a Virtual Directory
Debug: STDOUT: New-Item : A parameter cannot be found that matches parameter name 'Application'.
Debug: STDOUT: Set-ItemProperty : Property application is not found on <PATH>
The reason for these errors is:
New-Item
does not have the parameter-Application
Set-ItemProperty
cannot use the propertyapplication
when the Virtual Directory was created with New-Item because that property doesn't get created by New-ItemExpected Behavior
The Virtual Directory gets created in IIS
Steps to Reproduce
puppet agent -t
Environment
Additional Context
The following is how I fixed the file webadministration.rb in my local environment:
Change function
Line 34:
cmd = []
tocmd = ["Import-Module WebAdministration;","Start-Sleep -Seconds 5;"]
to fix bug 1Line 42:
Add logic in case
@resource[:application]
exists to build the Path as@resource[:sitename]\\@resource[:application]
to avoid repeat corrective runs:Add the '-Name' Parameter in New-Item
Line 44:
cmd << "-Application \"#{@resource[:application]}\" " if @resource[:application]
Between Line 38 and Line 39Line 67:
cmd = []
tocmd = ["Import-Module WebAdministration;","Start-Sleep -Seconds 5;"]
to fix bug 1Update function
Line 70:
Suggestion - To handle or eliminate the error that occurs when "application" isn't in the Item Property of the Virtual Directory and application is specified: Adding
-ErrorAction SilentlyContinue
to the current command is a workaround. A more permanent solution would be to filter on the attribute 'application' from the Item-property, like this:Import-Module WebAdministration;Start-Sleep -Seconds 5;Get-ItemProperty -Path PATH | Get-Member -MemberType NoteProperty
and only run the command if it exists.Line 87:
cmd = []
tocmd = ["Import-Module WebAdministration;","Start-Sleep -Seconds 5;"]
to fix bug 1