Sha256: f4f8f8335981548b6894b90eba371977374a0154996cf909aff19d4e982391fe

Contents?: true

Size: 778 Bytes

Versions: 24

Compression:

Stored size: 778 Bytes

Contents

module Specinfra
  module Backend
    class Winrm < Base
      include PowerShell::ScriptHelper

      def run_command(cmd, opts={})
        set_config(:os, {:family => 'windows'})
        script = create_script(cmd)
        winrm = get_config(:winrm)

        result = winrm.powershell(script)
        stdout, stderr = [:stdout, :stderr].map do |s|
          result[:data].select {|item| item.key? s}.map {|item| item[s]}.join
        end
        result[:exitcode] = 1 if result[:exitcode] == 0 and !stderr.empty?

        if @example
          @example.metadata[:command] = script
          @example.metadata[:stdout]  = stdout + stderr
        end

        CommandResult.new :stdout => stdout, :stderr => stderr, :exit_status => result[:exitcode]
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
specinfra-2.34.3 lib/specinfra/backend/winrm.rb
specinfra-2.34.2 lib/specinfra/backend/winrm.rb
specinfra-2.34.1 lib/specinfra/backend/winrm.rb
specinfra-2.34.0 lib/specinfra/backend/winrm.rb
specinfra-2.33.1 lib/specinfra/backend/winrm.rb
specinfra-2.33.0 lib/specinfra/backend/winrm.rb
specinfra-2.32.0 lib/specinfra/backend/winrm.rb
specinfra-2.31.1 lib/specinfra/backend/winrm.rb
specinfra-2.31.0 lib/specinfra/backend/winrm.rb
specinfra-2.30.4 lib/specinfra/backend/winrm.rb
specinfra-2.30.3 lib/specinfra/backend/winrm.rb
specinfra-2.30.2 lib/specinfra/backend/winrm.rb
specinfra-2.30.1 lib/specinfra/backend/winrm.rb
specinfra-2.30.0 lib/specinfra/backend/winrm.rb
specinfra-2.29.0 lib/specinfra/backend/winrm.rb
specinfra-2.28.4 lib/specinfra/backend/winrm.rb
specinfra-2.28.3 lib/specinfra/backend/winrm.rb
specinfra-2.28.2 lib/specinfra/backend/winrm.rb
specinfra-2.28.1 lib/specinfra/backend/winrm.rb
specinfra-2.28.0 lib/specinfra/backend/winrm.rb