Method: Naginata::CLI::Fetch#run

Defined in:
lib/naginata/cli/fetch.rb

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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