Skip to content

Commit

Permalink
Fix rails 6.1 deprecation/ 7.0 removal (use configs_for)
Browse files Browse the repository at this point in the history
DEPRECATION WARNING: [] is deprecated and will be removed from Rails 7.0 (Use configs_for)
  • Loading branch information
jrafanie committed May 14, 2024
1 parent 5cfc044 commit b9a770c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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).first.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).first.configuration_hash["password"]
].map { |v| ManageIQ::Password.encrypt(v) }
rescue OpenURI::HTTPError
nil
Expand Down
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).first.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).first.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).first.configuration_hash["username"],
:type => "AuthUseridPassword"
)
expect(auths.count).to eq(1)
Expand Down

0 comments on commit b9a770c

Please sign in to comment.