Sha256: 30a5df7970e39453ed89b0aa043895333553e21346ee4ee9c969c8e14d240937
Contents?: true
Size: 685 Bytes
Versions: 16
Compression:
Stored size: 685 Bytes
Contents
class MigratePortOverridesToInt < ActiveRecord::Migration[5.2] def up transform_lookup_values :to_i end def down transform_lookup_values :to_s end private def transform_lookup_values(method) return unless Foreman::Plugin.installed?("foreman_puppet") puppet_class = ::ForemanPuppet::Puppetclass.find_by :name => 'foreman_scap_client' return unless puppet_class port_key = puppet_class.class_params.find_by :key => 'port' return unless port_key port_key.lookup_values.in_batches do |batch| batch.each do |lookup_value| lookup_value.value = lookup_value.value.send(method) lookup_value.save end end end end
Version data entries
16 entries across 16 versions & 1 rubygems