Uploaded image for project: 'Puppet Task Runner'
  1. Puppet Task Runner
  2. BOLT-406

WinRM connector should make ConvertTo-Json / ConvertFrom-Json available in PS2

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: BOLT 0.17.0
    • Fix Version/s: None
    • Component/s: WinRM
    • Labels:
      None
    • Template:
    • QA Risk Assessment:
      Needs Assessment

      Description

      Since it is common to want to return JSON data from tasks, and since it can be problematic to build inline JSON given escaping / formatting rules, there should be a facility always available for task authors to produce JSON from PowerShell.

       

      Normally this can be done using PowerShell 3 and above using the  ConvertTo-Json and ConvertFrom-Json cmdlets.  However, Bolt and PE tasks explicitly support PS2+ so for PS2, a polyfill is necessary to make these cmdlets available.  Bolt code already does something similar for its own purposes at https://github.com/puppetlabs/bolt/blob/a53f2f872a82b2a5ba6a4d8961243f2cb7c1ce1f/lib/bolt/transport/winrm/connection.rb#L205-L380 as does the implementation of PE tasks at https://github.com/puppetlabs/pxp-agent/blob/33a76e0080e61b353dff9fbf17e4dbede44bd09b/exe/PowershellShim-Helper.ps1 .  These facilities just need to be surfaced to end users.

       

      Otherwise, if users wish to write PowerShell tasks that support all PowerShell versions, they must build inline JSON strings.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  ethan Ethan Brown
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated: