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

Powershell module continue to run on error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None
    • powershell
    • Modules
    • Reviewed

    Description

      Using of < input redirection causes the following issues as script passed line by line.
      The script continue to run even if it faces the critical error which should make it fail immediately.
      puppet code

        exec { "configure_iis6_metabase": #
          command   => template('iis6_metabase/powershell/configure_iis6_metabase.ps1'),
          unless    => template('iis6_metabase/powershell/check_iis6_metabase.ps1'),
          provider  => powershell,
          logoutput => true
        }
      

      Test №1:
      test.ps1

      $erroractionpreference = "stop"
      throw "bla"
      echo "test"
      

      "exits with code 0 - wrong behavior"

      Test №2:

      $erroractionpreference = "stop"
      throw "bla"
      

      "exits with code 1 - correct behavior"

      Test №3(all commands in one line):

      $erroractionpreference = "stop"
      throw "bla";echo "test"
      

      "exits with code 0 - correct behavior"

      Attachments

        Issue Links

          Activity

            People

              rob Rob Reynolds
              pesetskyps pavel pesetsky
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support