Sha256: eea4f6df3c959d851c2b50f610c02a786180868fb7f9b1d5670961d276a4126d

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

require 'mixlib/shellout'

module Cassandra
  module Utils
    module CLI
      class Base
        attr_reader :command, :stdout

        def cwd
          '/tmp'
        end

        def timeout
          300
        end

        def runner
          @command ||= Mixlib::ShellOut.new(command, :cwd => cwd, :timeout => timeout)
        end

        def output
          raise NotImplementedError, 'Must implement this in a subclass'
        end

        def run!
          runner
          @command.run_command
          @command.error!
          @stdout = @command.stdout
          out = output
          Utils::Statsd.new(metric_name).to_dd(out).push!
          out
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cassandra-utils-0.3.1.pre.beta.1 lib/cassandra/utils/cli/base.rb