Class: Upman::Worker::ReportInstallHistory

Inherits:
BaseWorker
  • Object
show all
Defined in:
lib/upman/worker/report_install_history.rb

Instance Method Summary collapse

Methods included from Utils::Helper

#fail, #info, #success, #warn

Instance Method Details

#registerObject



5
6
7
# File 'lib/upman/worker/report_install_history.rb', line 5

def register
  return self
end

#run!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/upman/worker/report_install_history.rb', line 9

def run!
  while true
    install_history_service = ::Upman::Service::InstallHistory.new
    data = install_history_service.get("")

    info "Report install history to API"


    node_service = Upman::Service::Node.new
    node_uuid = node_service.get_node_uuuid

    api = ::Upman::Utils::Api.new
    api.post("upman/node/install_history?uuid=#{node_uuid}", "{\"data\": #{data.to_json}}")

    sleep(::Upman::Core::Config.daemon[:interval])
  end
end