Sha256: fdf9351c34fffcc5499951cb8e7dd8a7c6a7357c02bbf164a26455fc4b575ef5

Contents?: true

Size: 637 Bytes

Versions: 6

Compression:

Stored size: 637 Bytes

Contents

class UpdatePuppetPortParamType < ActiveRecord::Migration[6.0]
  def up
    update_port_type :to_i
  end

  def down
    update_port_type :to_s
  end

  private

  def update_port_type(method)
    puppet_class = 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

    if method == :to_i
      port_key.update_columns(:key_type => "integer", :default_value => port_key.default_value.to_i)
    else
      port_key.update_columns(:key_type => "string", :default_value => port_key.default_value.to_s)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_openscap-4.3.3 db/migrate/20201202110213_update_puppet_port_param_type.rb
foreman_openscap-4.3.2 db/migrate/20201202110213_update_puppet_port_param_type.rb
foreman_openscap-4.3.1 db/migrate/20201202110213_update_puppet_port_param_type.rb
foreman_openscap-4.3.0 db/migrate/20201202110213_update_puppet_port_param_type.rb
foreman_openscap-4.1.3 db/migrate/20201202110213_update_puppet_port_param_type.rb
foreman_openscap-4.0.6 db/migrate/20201202110213_update_puppet_port_param_type.rb