Sha256: 3d5c8d37ca7c94a04e503a7530df536ee339a54aaec1f4df7930d10f8e502c49

Contents?: true

Size: 880 Bytes

Versions: 83

Compression:

Stored size: 880 Bytes

Contents

module Serverspec
  module Type
    class Command < Base
      def return_stdout?(content)
        ret = backend.run_command(@name)
        if content.instance_of?(Regexp)
          ret[:stdout] =~ content
        else
          ret[:stdout].strip == content
        end
      end

      def return_stderr?(content)
        ret = backend.run_command(@name)
        # In ssh access with pty, stderr is merged to stdout
        # See http://stackoverflow.com/questions/7937651/receiving-extended-data-with-ssh-using-twisted-conch-as-client
        # So I use stdout instead of stderr
        if content.instance_of?(Regexp)
          ret[:stdout] =~ content
        else
          ret[:stdout].strip == content
        end
      end

      def return_exit_status?(status)
        ret = backend.run_command(@name)
        ret[:exit_status].to_i == status
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
serverspec-0.10.5 lib/serverspec/type/command.rb
serverspec-0.10.4 lib/serverspec/type/command.rb
serverspec-0.10.3 lib/serverspec/type/command.rb
serverspec-0.10.2 lib/serverspec/type/command.rb
serverspec-0.10.1 lib/serverspec/type/command.rb
serverspec-0.10.0 lib/serverspec/type/command.rb
serverspec-0.9.8 lib/serverspec/type/command.rb
serverspec-0.9.7 lib/serverspec/type/command.rb
serverspec-0.9.6 lib/serverspec/type/command.rb
serverspec-0.9.5 lib/serverspec/type/command.rb
serverspec-0.9.4 lib/serverspec/type/command.rb
serverspec-0.9.3 lib/serverspec/type/command.rb
serverspec-0.9.2 lib/serverspec/type/command.rb
serverspec-0.9.1 lib/serverspec/type/command.rb
serverspec-0.9.0 lib/serverspec/type/command.rb
serverspec-0.8.1 lib/serverspec/type/command.rb
serverspec-0.8.0 lib/serverspec/type/command.rb
serverspec-0.7.13 lib/serverspec/type/command.rb
serverspec-0.7.12 lib/serverspec/type/command.rb
serverspec-0.7.11 lib/serverspec/type/command.rb