Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-1547

Cannot use PDK and Bolt in the same PowerShell session (Process)

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • PDK 1.15.0
    • None
    • None
    • Windows 10 - 1903
      PDK 1.14.1
      Bolt 1.13.1

      • Should be able to use the PDK and Bolt products together without errors
    • Puppet Developer Experience
    • Needs Assessment
    • Bug Fix
    • Hide
      Previously when using the PDK and Bolt PowerShell modules at the same time, conflicting environment variable settings could cause runtime errors in one or both tools. The PDK PowerShell module now ensures that the necessary environment variables are set on every invocation instead of only the first time the module is loaded.
      Show
      Previously when using the PDK and Bolt PowerShell modules at the same time, conflicting environment variable settings could cause runtime errors in one or both tools. The PDK PowerShell module now ensures that the necessary environment variables are set on every invocation instead of only the first time the module is loaded.
    • Needs Assessment

    Description

      If you run PDK, then Bolt and then PDK again, PDK will terminate with a ruby error

      C:\Source> pdk --version
      1.14.1
      C:\Source> bolt --version
      1.31.1
      C:\Source> pdk --version
      Traceback (most recent call last):
      C:\PROGRA~1\PUPPET~1\Bolt\bin\ruby: No such file or directory -- C:/PROGRA~1/PUPPET~1/Bolt/bin/pdk (LoadError)
      

      This also occurs in the reverse (bolt -> PDK -> Bolt)

      C:\Source> bolt --version
      1.31.1
      C:\Source> pdk --version
      1.14.1
      C:\Source> bolt --version
      C:\PROGRA~1\PUPPET~1\DEVELO~1\private\ruby\2.4.9\bin\ruby.exe: No such file or directory -- C:/PROGRA~1/PUPPET~1/DEVELO~1/private/ruby/2.4.9/bin/bolt (LoadError)
      

      This is due to both PowerShell wrappers managing the same Environment Variables (RUBY_DIR, SSL_CERT_FILE and SSL_CERT_DIR)

      https://github.com/puppetlabs/pdk-vanagon/blob/021c4382233a04a8e0a1536352fb9f27a300bf80/resources/files/windows/PuppetDevelopmentKit/PuppetDevelopmentKit.psm1#L6-L8

      https://github.com/puppetlabs/bolt-vanagon/blob/c48d7c60b7ec51675eeb11d64e8bc6c802883f2e/resources/files/windows/PuppetBolt/PuppetBolt.psm1#L6-L9

      Because these environment variables are only set at module import time, not at function invocation time, both wrappers are stomping over each other and causing errors.

      Ideally environment variables should not be used at all and instead use command line invocations.

      Attachments

        Issue Links

          Activity

            People

              glenn.sarti Glenn Sarti
              glenn.sarti Glenn Sarti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support