Sha256: e18fb4993d79fd9b76c5ca84a4f76e0be4725b524accd13746f6d10b0ac6bd39
Contents?: true
Size: 732 Bytes
Versions: 5
Compression:
Stored size: 732 Bytes
Contents
class FakeDiscoveredHost < ApplicationRecord self.table_name = 'hosts' end class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration[4.2] 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
5 entries across 5 versions & 1 rubygems