Method: RightScale::PowershellProviderBase.run_script

Defined in:
lib/chef/windows/powershell_provider_base.rb

.run_script(script) ⇒ Object

Run powershell script in associated Powershell instance

Parameters

script(String)

Fully qualified path to Powershell script

Return

true

Always return true



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/chef/windows/powershell_provider_base.rb', line 53

def self.run_script(script)
  if @ps_instance
    res = @ps_instance.run(script)

    # the powershell provider script the host runs will return exit code of 100 if the last action threw an exception.
    if res && res[:exit_code] && res[:exit_code] != 0
      message = "Unexpected exit code from action. Expected 0 but returned #{res[:exit_code]}.  Script: #{script}\n"
      message += "#{res[:error_msg]}"
      raise RightScale::Exceptions::Exec, message
    end
  end

  true
end