Module: PuppetLitmus::Util
- Defined in:
- lib/puppet_litmus/util.rb
Overview
Helper methods for testing puppet content
Class Method Summary collapse
-
.interpolate_powershell(command) ⇒ String
Ensure that a passed command is base 64 encoded and passed to PowerShell; this obviates the need to carefully interpolate strings for passing to ruby which will then be passed to PowerShell/CMD which will then be executed.
Class Method Details
.interpolate_powershell(command) ⇒ String
Ensure that a passed command is base 64 encoded and passed to PowerShell; this obviates the need to carefully interpolate strings for passing to ruby which will then be passed to PowerShell/CMD which will then be executed. This also ensures that a single PowerShell command may be specified for Windows targets leveraging PowerShell as bolt run_shell will use PowerShell against a remote target but CMD against a localhost target.
13 14 15 16 |
# File 'lib/puppet_litmus/util.rb', line 13 def self.interpolate_powershell(command) encoded_command = Base64.strict_encode64(command.encode('UTF-16LE')) "powershell.exe -NoProfile -EncodedCommand #{encoded_command}" end |