Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-6080

iis : iis_virtual_directory fails to ensure absent

    Details

    • Template:
      MODULES Bug Template
    • Acceptance Criteria:
      Hide

      Removes the virtual directory without error.

      Acceptance test added.

      Show
      Removes the virtual directory without error. Acceptance test added.
    • Epic Link:
    • Team:
      Windows
    • Story Points:
      1
    • Sprint:
      Windows 2019-03-27
    • Method Found:
      Manual Test
    • CS Priority:
      Major
    • CS Frequency:
      3 - 25-50% of Customers
    • CS Severity:
      3 - Serious
    • CS Business Value:
      4 - $$$$$
    • CS Impact:
      Customers expect our IIS module to work and it cannot manage this resource like it does on other operating systems.
    • QA Risk Assessment:
      Needs Assessment

      Description

      The provider fails to ensure absent.
      This is a known issue with Remove-WebVirtualDirectory which is called by the provider.

      Given:

      iis_virtual_directory { 'unc':
        ensure       => 'absent',
        sitename     => 'Default Web Site',
        physicalpath => '\\\\SERVER\\share',
      }
      

      The provider fails:

      PS C:\> puppet agent -t
      ...
      Debug: Destroying unc
      Debug: COMMAND: Remove-WebVirtualDirectory -Name "unc" -Site "Default Web Site" -Application "/" -ErrorAction Stop
      Debug: Waited 50 milliseconds...
      ...
      Debug: Wait object signaled
      Debug: Waited 0.140371 total seconds.
      Debug: STDOUT: remove-item : The method or operation is not implemented.
      At line:1 char:1
      + Remove-WebVirtualDirectory -Name "unc" -Site "Default Web Site" -Application "/" ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [Remove-Item], NotImplementedException
          + FullyQualifiedErrorId : System.NotImplementedException,Microsoft.PowerShell.Commands.RemoveItemCommand
       
      Notice: /Stage[main]/Main/Node[pe-201722-agent-win2012]/Iis_virtual_directory[unc]/ensure: removed
      ...
      

      For reference, the same PowerShell command on the command line:

      PS C:\> Remove-WebVirtualDirectory -Name "unc" -Site "Default Web Site" -Application "/" -ErrorAction Stop
       
      Confirm
      The item at IIS:\Sites\Default Web Site\\unc has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to continue?
      [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
      

      Remove-WebVirtualDirectory offers no Recurse parameter, and it is probably calling Remove-Item.

      Two possible solutions:

      # Use Remove-Item
      Remove-Item 'IIS:\\Sites\\#{@resource[:sitename]}\\#{@resource[:name]}' -Recurse
      

      # Set physicalPath to a temporary empty directory.
      empty_temp_directory = 'c:\windows\temp\empty_physical_path_directory'
      New-Item -ItemType Directory '#{empty_temp_directory}'
      Set-ItemProperty -Path 'IIS:\\Sites\\#{@resource[:sitename]}\\#{@resource[:name]}' -Name 'physicalPath' -Value '#{empty_temp_directory}'
      Remove-WebVirtualDirectory ...
      Remove-Item '#{empty_temp_directory}'
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  michael.lombardi Michael Lombardi
                  Reporter:
                  tom.kishel Thomas Kishel
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support