Sha256: 8020cc0d3b03571379786d06095f7ea7a1e5ad3f0a88a9d2970b53e13873ca14
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 Bytes
Contents
class FakeDiscoveredHost < ApplicationRecord self.table_name = 'hosts' end class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration[4.2] def up FakeDiscoveredHost.where(:type => "Host::Discovered").all.find_each do |host| begin say "Populating attribute set for discovered host #{host.name}" ForemanDiscovery::ImportHooks::DiscoveryAttribute.new(host: host, facts: host.facts_hash).after_populate host.save! rescue Exception => e say "Error while populating host #{host.name}, deleting: #{e.message}:\n" + e.backtrace.join("\n") host.destroy end end end def down end end
Version data entries
3 entries across 3 versions & 1 rubygems