class Naginata::CLI::Fetch

Public Instance Methods

load_remote_objects() click to toggle source
# File lib/naginata/cli/fetch.rb, line 25
def load_remote_objects
end
run() click to toggle source
# File lib/naginata/cli/fetch.rb, line 9
def run
  Naginata::Runner.run do |backend, nagios_server, services|
    status_file = (nagios_server.fetch(:status_file) || ::Naginata::Configuration.env.fetch(:nagios_server_options)[:status_file])
    if !@options[:dry_run]
      str = backend.capture(:cat, status_file)
      st = ::Naginata::Status.build(str, nagios_server.hostname)
      st.save
    else
      st = ::Naginata::Status.new
      st.hostname = nagios_server.hostname
    end
    puts "Saved into #{st.path}" if @options[:verbose]
  end

end