Skip to content

Commit

Permalink
Merge pull request #735 from jrafanie/backward_compatible_rails7_changes
Browse files Browse the repository at this point in the history
Backward compatible rails 7 changes
  • Loading branch information
Fryguy authored May 24, 2024
2 parents 6ce983d + 1d31791 commit 1a55e1a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def update_authentications
database_auth_find_args = db_args.merge(
:name => "Ansible Database Authentication",
:authtype => "ansible_database_password",
:userid => ApplicationRecord.configurations[Rails.env]["username"],
:userid => ApplicationRecord.configurations.configs_for(:env_name => Rails.env, :name => "primary").configuration_hash["username"],
:type => "AuthUseridPassword"
)

Expand All @@ -78,7 +78,7 @@ def get_secret_data
decoded_data["secret-key"],
decoded_data["rabbit-password"],
decoded_data["admin-password"],
ApplicationRecord.configurations[Rails.env]["password"]
ApplicationRecord.configurations.configs_for(:env_name => Rails.env, :name => "primary").configuration_hash["password"]
].map { |v| ManageIQ::Password.encrypt(v) }
rescue OpenURI::HTTPError
nil
Expand Down
21 changes: 10 additions & 11 deletions db/migrate/20220111170303_fix_child_container_manager_sti.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ def up
ServiceParametersSet.in_my_region.where(:ext_management_system => managers).update_all(:type => "#{provider_klass}::ServiceParametersSet")
end
end
end

def down
PROVIDERS.each do |provider|
provider_klass = "ManageIQ::Providers::#{provider}::ContainerManager"
say_with_time("Resetting STI class for #{provider_klass}") do
managers = ExtManagementSystem.in_my_region.where(:type => provider_klass)

ContainerTemplate.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceInstance.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceOffering.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceParametersSet.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
end
def down
PROVIDERS.each do |provider|
provider_klass = "ManageIQ::Providers::#{provider}::ContainerManager"
say_with_time("Resetting STI class for #{provider_klass}") do
managers = ExtManagementSystem.in_my_region.where(:type => provider_klass)
ContainerTemplate.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceInstance.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceOffering.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
ServiceParametersSet.in_my_region.where(:ext_management_system => managers).update_all(:type => nil)
end
end
end
Expand Down
8 changes: 0 additions & 8 deletions spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true

Expand Down
6 changes: 0 additions & 6 deletions spec/dummy/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'

Expand Down
14 changes: 0 additions & 14 deletions spec/dummy/config/initializers/assets.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
expect(database_authentications.count).to eq(4)
expect(ansible_secret_key).to eq("secretkey")
expect(ansible_rabbitmq_password).to eq("rabbitpassword")
expect(ansible_database_password).to eq(ApplicationRecord.configurations[Rails.env]["password"])
expect(ansible_database_password).to eq(ApplicationRecord.configurations.configs_for(:env_name => Rails.env, :name => "primary").configuration_hash["password"])
end

it "updates authentications with the secret values" do
Expand All @@ -105,7 +105,7 @@
expect(ansible_secret_key).to eq("secretkey")
expect(ansible_rabbitmq_password).to eq("rabbitpassword")
expect(ansible_admin_password).to eq("adminpassword")
expect(ansible_database_password).to eq(ApplicationRecord.configurations[Rails.env]["password"])
expect(ansible_database_password).to eq(ApplicationRecord.configurations.configs_for(:env_name => Rails.env, :name => "primary").configuration_hash["password"])
end
end
end
Expand Down Expand Up @@ -161,7 +161,7 @@ def ansible_database_password
auths = database_authentications.where(
:name => "Ansible Database Authentication",
:authtype => "ansible_database_password",
:userid => ApplicationRecord.configurations[Rails.env]["username"],
:userid => ApplicationRecord.configurations.configs_for(:env_name => Rails.env, :name => "primary").configuration_hash["username"],
:type => "AuthUseridPassword"
)
expect(auths.count).to eq(1)
Expand Down

0 comments on commit 1a55e1a

Please sign in to comment.