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

iis : iis_virtual_directory calls update after destroy

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: IIS 4.2.1
    • Component/s: iis
    • Labels:
    • Environment:

      Windows 2012 R2
      puppetlabs-iis 4.20

    • Template:
      MODULES Bug Template
    • Epic Link:
    • Team:
      Windows
    • Sprint:
      Windows Kanban
    • Method Found:
      Manual Test
    • QA Risk Assessment:
      Needs Assessment

      Description

      The update() method in iis_virtual_directory/webadministration.rb is called after destroy() by flush() in ../iis_powershell.rb

      The update method will then attempt to use Set-ItemProperty on a virtual directory that it just removed via Remove-WebVirtualDirectory

      Adding the following to update in lib/puppet/provider/iis_virtual_directory/webadministration.rb and running puppet with debug documents this ...

      def update
        if (@resource[:ensure] == :absent)
          Puppet.debug "Skipping update after destroy for #{@resource[:name]}"
          return
        end
      end
      

      iis_virtual_directory { 'local':
        ensure       => 'absent',
        sitename     => 'Default Web Site',
        physicalpath => 'c:\\inetpub\\virtual_directory',
      }
      

      PS C:\> Get-WebVirtualDirectory
       
      Name             Physical Path
      ----             -------------
      local            c:\inetpub\virtual_directory
      

      PS C:\> puppet agent -t -d
       
      ...
       
      Debug: Prefetching webadministration resources for iis_virtual_directory
      Debug: COMMAND: Get-WebVirtualDirectory | ForEach-Object {
        $physicalpath = [string]$_.PhysicalPath
       
        $name = [string]$_.Path
        $name = $name -Replace "^/", ''
        $name = $name -Replace "/",  '\'
       
        if ($_.ItemXPath -Match "application\[\@path\=(.*?)\]") {
          $application = $matches[1].Replace("'", '')
        } else {
          $application = '/'
        }
       
        if ($_.ItemXPath -Match "site\[\@name\=(.*?) and") {
          $sitename = $matches[1].Replace("'", '')
        } else {
          $sitename = ''
        }
       
        New-Object -TypeName PSObject -Property @{
          name         = $name
          physicalpath = $physicalpath
          application  = $application
          sitename     = $sitename
        }
       
      } | ConvertTo-Json -Depth 10
       
      Debug: Waited 50 milliseconds...
      Debug: Wait object signaled
      Debug: Waited 0.140623 total seconds.
      Debug: 2017-11-17 16:05:49 +0000 PIPE> <ReturnResult><Property Name="exitcode">0</Property><Property Name="errormessage"></Property><Property Name="stderr"></Property><Property Name="st
      dout">Ww0KICAgIHsNCiAgICAgICAgInNpdGVuYW1lIjogICJEZWZhdWx0IFdlYiBTaXRlIiwNCiAgICAgICAgIm5hbWUiOiAgInVuYyIsDQogICAgICAgICJwaHlzaWNhbHBhdGgiOiAgIlxcXFxTRVJWRVJcXHNoYXJlIiwNCiAgICAgICAgImF
      wcGxpY2F0aW9uIjogICIvIg0KICAgIH0sDQogICAgew0KICAgICAgICAic2l0ZW5hbWUiOiAgIkRlZmF1bHQgV2ViIFNpdGUiLA0KICAgICAgICAibmFtZSI6ICAibG9jYWwiLA0KICAgICAgICAicGh5c2ljYWxwYXRoIjogICJjOlxcaW5ldHB1
      YlxcdmlydHVhbF9kaXJlY3RvcnkiLA0KICAgICAgICAiYXBwbGljYXRpb24iOiAgIi8iDQogICAgfQ0KXQ0K</Property></ReturnResult>
       
      Debug: STDOUT: [
      {
              "sitename":  "Default Web Site",
              "name":  "local",
              "physicalpath":  "c:\\inetpub\\virtual_directory",
              "application":  "/"
          }
      ]
       
      ...
       
      Debug: Destroying local
      Debug: COMMAND: Remove-WebVirtualDirectory -Name "local" -Site "Default Web Site" -Application "/" -ErrorAction Stop
      Debug: Waited 50 milliseconds...
      Debug: Wait object signaled
      Debug: Waited 0.092786 total seconds.
      Debug: 2017-11-17 16:05:50 +0000 PIPE> <ReturnResult><Property Name="exitcode">0</Property><Property Name="errormessage"></Property><Property Name="stderr"></Property><Property Name="st
      dout"></Property></ReturnResult>
       
      Notice: /Stage[main]/Main/Node[pe-201722-agent-win2012]/Iis_virtual_directory[local]/ensure: removed
      Debug: Skipping update after destroy for local
      Debug: /Stage[main]/Main/Node[pe-201722-agent-win2012]/Iis_virtual_directory[local]: The container Node[pe-201722-agent-win2012] will propagate my refresh event
      Debug: Node[pe-201722-agent-win2012]: The container Class[Main] will propagate my refresh event
       
      ...
       
      Debug: Finishing transaction 40145220
      Debug: Storing state
      Debug: Stored state in 0.06 seconds
      Notice: Applied catalog in 4.92 seconds
      Debug: Dynamically-bound server lookup failed, falling back to report_server setting
      Debug: Dynamically-bound port lookup failed; falling back to report_port setting
      Debug: Using cached connection for https://pe-201722-master.puppetdebug.vlan:8140
      Debug: Caching connection for https://pe-201722-master.puppetdebug.vlan:8140
      Debug: Closing connection for https://pe-201722-master.puppetdebug.vlan:8140
       
      PS C:\Users\Administrator>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              james.pogran James Pogran
              Reporter:
              tom.kishel Thomas Kishel
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support