module Ronin::Cache
Public Class Methods
cache_config(config)
click to toggle source
# File lib/ronin/cache.rb, line 23 def cache_config(config) Ronin::Log.info("Caching configuration items from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/config.json.") File.open("#{Ronin::Config[:cache_path]}/config.json", "w") do |f| f.write(config.to_json) end end
cache_run_list(run_list)
click to toggle source
# File lib/ronin/cache.rb, line 43 def cache_run_list(run_list) Ronin::Log.info("Caching run_list from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/run_list.json.") File.open("#{Ronin::Config[:cache_path]}/run_list.json", "w") do |f| f.write(run_list.to_json) end end
load_cached_config()
click to toggle source
# File lib/ronin/cache.rb, line 32 def load_cached_config if File.exist?("#{Ronin::Config[:cache_path]}/config.json") Ronin::Log.info("Loading cached configuration items from #{Ronin::Config[:cache_path]}/config.json.") @config = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/config.json")) return @config else abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached config found at (#{Ronin::Config[:cache_path]}/config.json)") end end
load_cached_run_list()
click to toggle source
# File lib/ronin/cache.rb, line 51 def load_cached_run_list if File.exist?("#{Ronin::Config[:cache_path]}/run_list.json") Ronin::Log.info("Loading cached run list items from #{Ronin::Config[:cache_path]}/run_list.json.") @run_list = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/run_list.json")) return @run_list else abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached run list found at (#{Ronin::Config[:cache_path]}/run_list.json)") end end
Private Instance Methods
cache_config(config)
click to toggle source
# File lib/ronin/cache.rb, line 23 def cache_config(config) Ronin::Log.info("Caching configuration items from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/config.json.") File.open("#{Ronin::Config[:cache_path]}/config.json", "w") do |f| f.write(config.to_json) end end
cache_run_list(run_list)
click to toggle source
# File lib/ronin/cache.rb, line 43 def cache_run_list(run_list) Ronin::Log.info("Caching run_list from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/run_list.json.") File.open("#{Ronin::Config[:cache_path]}/run_list.json", "w") do |f| f.write(run_list.to_json) end end
load_cached_config()
click to toggle source
# File lib/ronin/cache.rb, line 32 def load_cached_config if File.exist?("#{Ronin::Config[:cache_path]}/config.json") Ronin::Log.info("Loading cached configuration items from #{Ronin::Config[:cache_path]}/config.json.") @config = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/config.json")) return @config else abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached config found at (#{Ronin::Config[:cache_path]}/config.json)") end end
load_cached_run_list()
click to toggle source
# File lib/ronin/cache.rb, line 51 def load_cached_run_list if File.exist?("#{Ronin::Config[:cache_path]}/run_list.json") Ronin::Log.info("Loading cached run list items from #{Ronin::Config[:cache_path]}/run_list.json.") @run_list = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/run_list.json")) return @run_list else abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached run list found at (#{Ronin::Config[:cache_path]}/run_list.json)") end end