Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backward compatible rails 7 changes #735

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! I can't believe 6.1 didn't fail previously with this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow


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