def sync_host_table
      uri = foreman_uri('/hosts?per_page=9999999')
      debug "Loading hosts from #{uri}"
      json = RestClient.get uri
      debug "Got JSON: #{json}"
      JSON.parse(json)['results'].each do |rec|
        @db.execute "insert into host (id,name) values ( ?, ? )",
                   rec['id'], rec['name']
      end
    end
def sync_host_table
      uri = foreman_uri('/hosts?per_page=9999999')
      debug "Loading hosts from 
      json = RestClient.get uri
      debug "Got JSON: 
      JSON.parse(json)['results'].each do |rec|
        @db.execute "insert into host (id,name) values ( ?, ? )",
                   rec['id'], rec['name']
      end
    end
def sync_host_table uri = foreman_uri ( '/hosts?per_page=9999999' ) debug "Loading hosts from #{uri}" json = RestClient . get uri debug "Got JSON: #{json}" JSON . parse ( json ) [ 'results' ] . each do | rec | @db . execute "insert into host (id,name) values ( ?, ? )" , rec [ 'id' ] , rec [ 'name' ] end end
Get all the host IDs and FQDNs and populate the host table
Get all the host IDs and FQDNs and populate the host table