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

IIS : puppet resource iis_virtual_directory doesn't fail with a meaningful error when sitename is omitted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
      MODULES Bug Template
    • Acceptance Criteria:
      Hide

      puppet resource iis_virtualdirectory ensure=present should fail hard without a sitename specified

      Show
      puppet resource iis_virtualdirectory ensure=present should fail hard without a sitename specified
    • Epic Link:
    • Team:
      Windows
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment

      Description

      IIS 4.2.0

      Assuming c:\foo exists, executing the following command fails but reports that it has succeeded:

      puppet resource iis_virtual_directory foo physicalpath=c:/foo ensure=present
      

      Output

      C:\source\puppetlabs-iis [pr/136]> md c:\foo
       
       
          Directory: C:\
       
       
      Mode                LastWriteTime         Length Name
      ----                -------------         ------ ----
      d-----       11/28/2017   5:21 PM                foo
       
       
      bundle exec puppet resource iis_virtual_directory foo physicalpath=c:/foo ensure=present --modulepath .\spec\fixtures\modules\ --debug
      Debug: Runtime environment: puppet_version=5.3.3, ruby_version=2.4.1, run_mode=user, default_encoding=IBM437
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Debug: Loaded state in 0.06 seconds
      Debug: Loaded transaction store file in 0.00 seconds
      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: 2017-11-28 17:28:11 -0800 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - is running as pid: 4560
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Wait object signaled
      Debug: Waited 2.515625 total seconds.
      Debug: 2017-11-28 17:28:15 -0800 PowerShell initialization complete for pid: 4560
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Wait object signaled
      Debug: Waited 1.78125 total seconds.
      Debug: 2017-11-28 17:28:17 -0800 PIPE> <ReturnResult><Property Name="exitcode">0</Property><Property Name="errormessage"></Property><Property Name="stderr"></Property><Property Name="stdout"></Property></ReturnResult>
       
      Debug: Creating foo
      Debug: COMMAND: New-WebVirtualDirectory -Name "foo" -PhysicalPath "c:/foo" -ErrorAction Stop
      Debug: Waited 50 milliseconds...
      Debug: Waited 50 milliseconds...
      Debug: Wait object signaled
      Debug: Waited 0.34375 total seconds.
      Debug: 2017-11-28 17:28:17 -0800 PIPE> <ReturnResult><Property Name="exitcode">0</Property><Property Name="errormessage"></Property><Property Name="stderr"></Property><Property Name="stdout">TmV3LVdlYlZpcnR1YWxEaXJlY3RvcnkgOiBWYWx1ZSBjYW5ub3QgYmUgbnVsbC4NClBhcmFtZXRlciBuYW1lOiBTaXRlDQpBdCBsaW5lOjEgY2hhcjoxDQorIE5ldy1XZWJWaXJ0dWFsRGlyZWN0b3J5IC1OYW1lICJmb28iIC1QaHlzaWNhbFBhdGggImM6L2ZvbyIgLUVycm9yQWN0aSAuLi4NCisgfn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+DQogICAgKyBDYXRlZ29yeUluZm8gICAgICAgICAgOiBOb3RTcGVjaWZpZWQ6ICg6KSBbTmV3LVdlYlZpcnR1YWxEaXJlY3RvcnldLCBBcmd1bWVudE51bGxFeGNlcHRpb24NCiAgICArIEZ1bGx5UXVhbGlmaWVkRXJyb3JJZCA6IFN5c3RlbS5Bcmd1bWVudE51bGxFeGNlcHRpb24sTWljcm9zb2Z0LklJcy5Qb3dlclNoZWxsLlByb3ZpZGVyLk5ld1ZpcnR1YWxEaXJlY3RvcnlDb21tYW4gDQogICBkDQogDQo=</Property></ReturnResult>
       
      Debug: STDOUT: New-WebVirtualDirectory : Value cannot be null.
      Parameter name: Site
      At line:1 char:1
      + New-WebVirtualDirectory -Name "foo" -PhysicalPath "c:/foo" -ErrorActi ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [New-WebVirtualDirectory], ArgumentNullException
          + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.IIs.PowerShell.Provider.NewVirtualDirectoryComman
         d
       
       
      Notice: /Iis_virtual_directory[foo]/ensure: created
      Debug: Finishing transaction 39953260
      Debug: Storing state
      Debug: Stored state in 0.08 seconds
      iis_virtual_directory { 'foo':
        ensure => 'absent',
      }
      Debug: PowerShellManager exiting...
      

      The failure is expected, given sitename is a mandatory parameter - the Puppet output in this case is incorrect.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              william.hurt William Hurt
              Reporter:
              ethan Ethan Brown
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support