Sha256: 6c88cd2aace9500affa2d29bcc83b9827366a59057ad4bd5a59bbc3bec70040e
Contents?: true
Size: 1.01 KB
Versions: 11
Compression:
Stored size: 1.01 KB
Contents
module LitmusPaper class StatusFile attr_reader :health def self.global_down_file new("global_down", 0) end def self.global_up_file new("global_up", 100) end def self.service_down_file(service_name) new("#{service_name}_down", 0) end def self.service_up_file(service_name) new("#{service_name}_up", 100) end def self.priority_check_order_for_service(service_name) [ global_down_file, global_up_file, service_down_file(service_name), service_up_file(service_name) ] end def initialize(filename, health) @path = File.join(LitmusPaper.data_directory, filename) @health = health end def content File.read(@path).chomp end def create(reason) FileUtils.mkdir_p(File.dirname(@path)) File.open(@path, 'w') do |file| file.puts(reason) end end def delete FileUtils.rm(@path) end def exists? File.exists?(@path) end end end
Version data entries
11 entries across 11 versions & 1 rubygems