Sha256: 2a0aa4b08446b80a47d003f83b1e9f7d572c4dca70f97d5b62daa376cddd42ff
Contents?: true
Size: 728 Bytes
Versions: 11
Compression:
Stored size: 728 Bytes
Contents
class FakeDiscoveredHost < ActiveRecord::Base self.table_name = 'hosts' end class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration def up FakeDiscoveredHost.where(:type => "Host::Discovered").all.each do |host| begin say "Populating attribute set for discovered host #{host.name}" host.discovery_attribute_set = DiscoveryAttributeSet.where(:host_id => host.id).first_or_create host.discovery_attribute_set.update_attributes(host.import_from_facts) 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
11 entries across 11 versions & 1 rubygems