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

PowerShell module 2.x does not respect environment parameter - doesn't receive environment variables passed through

    XMLWordPrintable

    Details

    • Template:
    • Acceptance Criteria:
      Hide

      Given a simple manifest

      exec { 'test envvars':
          command     => 'Write-Output "TESTVALUE = $env:TESTVALUE"',
          provider    => powershell,
          logoutput   => true,
          environment => ["TESTVALUE=YES"],
      }
      

      The output should be

      Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE = YES
      {no format}
       
      Conversely, given a simple manifest a second run will not have the env variable set in the first run:
       
      {code}
      exec { 'test envvars':
          command     => 'Write-Output "TESTVALUE = $env:TESTVALUE"',
          provider    => powershell,
          logoutput   => true,
          environment => ["TESTVALUE=YES"],
      }
      exec { 'test envvars':
          command     => 'Write-Output "TESTVALUE = $env:TESTVALUE"',
          provider    => powershell,
          logoutput   => true,
      }
      {code}
       
      The output in the first run should be 
      
      

      Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE = YES

      {no format}


      The output in the second run should be

       


      Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE ={no format}

      Show
      Given a simple manifest exec { 'test envvars': command => 'Write-Output "TESTVALUE = $env:TESTVALUE"', provider => powershell, logoutput => true, environment => ["TESTVALUE=YES"], } The output should be Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE = YES {no format}   Conversely, given a simple manifest a second run will not have the env variable set in the first run:   {code} exec { 'test envvars': command => 'Write-Output "TESTVALUE = $env:TESTVALUE"', provider => powershell, logoutput => true, environment => ["TESTVALUE=YES"], } exec { 'test envvars': command => 'Write-Output "TESTVALUE = $env:TESTVALUE"', provider => powershell, logoutput => true, } {code}   The output in the first run should be Notice: /Stage [main] /Exec [test envvars] /returns: TESTVALUE = YES {no format} The output in the second run should be   Notice: /Stage [main] /Exec [test envvars] /returns: TESTVALUE ={no format}
    • Team:
      Modules
    • Story Points:
      3
    • Sprint:
      Modules Triage, Modules 2016-12-14, Modules 2017-01-11, Modules 2017-01-25, Modules 2017-02-08
    • QA Risk Assessment:
      Automate

      Description

      In newer versions of PowerShell, it looks like environment variables are not getting passed through.

      exec { 'test environment variables':
          command     => 'Write-Output "TESTVALUE = $env:TESTVALUE"',
          provider    => powershell,
          logoutput   => true,
          environment => ["TESTVALUE=YES"],
      }
      

      Tested against 2.0.0 up to 2.1.0 and this was returned every time.

      Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE = 
      

      In version 1.0.6, the return looks like this:

      Notice: /Stage[main]/Exec[test envvars]/returns: TESTVALUE = YES
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              rob Rob Reynolds
              QA Contact:
              Erick Banks
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support