Sha256: 0e3c56a78be3f76f8af43ee5f4b785a92fa27226344132e2f390ed08db1ddbde

Contents?: true

Size: 810 Bytes

Versions: 20

Compression:

Stored size: 810 Bytes

Contents

module Ring
class SQA
class Alarm

  class Exec
    def send opts
      stdout = JSON.pretty_generate( {
        :alarm_buffer => opts[:alarm_buffer].exceeding_nodes,
        :nodes        => opts[:nodes].all,
        :short        => opts[:short],
        :long         => opts[:long],
        :status       => opts[:status],
        :afi          => opts[:afi],
      })
      exec stdout, CFG.exec.command, CFG.exec.arguments?
    rescue => error
      Log.error "Exec raised '#{error.class}' with message '#{error.message}'"
    end

    private

    def exec write, cmd, args
      args = '' unless args
      args = args.split ' '
      Open3.popen3(cmd, *args) do |stdin, stdout, stderr, wait_thr|
        stdin.write write
        stdin.close
        wait_thr.join
      end
    end
  end

end
end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ring-sqa-0.4.3 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.4.2 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.4.1 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.3.1 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.3.0 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.2.2 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.2.1 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.2.0 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.12 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.11 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.10 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.9 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.8 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.7 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.6 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.5 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.4 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.3 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.2 lib/ring/sqa/alarm/exec.rb
ring-sqa-0.1.1 lib/ring/sqa/alarm/exec.rb