Sha256: c4712c0981cbeec753dc8b3cc65745eb864f06d5d54e18762f1b1f0a92e154cb
Contents?: true
Size: 921 Bytes
Versions: 8
Compression:
Stored size: 921 Bytes
Contents
# rubocop:disable Metrics/MethodLength class ForemanGceToForemanGoogleGce < ActiveRecord::Migration[6.0] def up User.without_auditing do original_type = 'Foreman::Model::GCE' new_type = 'ForemanGoogle::GCE' # First update the type to avoid error: # ActiveRecord::SubclassNotFound: The single-table inheritance # mechanism failed to locate the subclass: 'Foreman::Model::GCE' ComputeResource.unscoped.where(type: original_type).update_all(type: new_type) ComputeResource.unscoped.where(type: new_type).each do |cr| unless cr.attrs[:key_path] say("Compute resource [#{cr.name}] is missing path to JSON key file, can't load the data. Please update the resource manually.") next end json_data = File.read(cr.attrs[:key_path]) cr.update(password: json_data) end end end end # rubocop:enable Metrics/MethodLength
Version data entries
8 entries across 8 versions & 1 rubygems