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

Replace class objects in query values with strings to fix a rails 5.0 deprecation #18827

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
4 changes: 2 additions & 2 deletions app/models/cloud_tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def self.create_cloud_tenant_queue(userid, ext_management_system, options = {})
:userid => userid
}
queue_opts = {
:class_name => class_by_ems(ext_management_system),
:class_name => class_by_ems(ext_management_system).name,
:method_name => 'create_cloud_tenant',
:priority => MiqQueue::HIGH_PRIORITY,
:role => 'ems_operations',
Expand Down Expand Up @@ -156,7 +156,7 @@ def self.post_refresh_ems(ems_id, _)
ems = ExtManagementSystem.find(ems_id)

MiqQueue.put_unless_exists(
:class_name => ems.class,
:class_name => ems.class.name,
:instance_id => ems_id,
:method_name => 'sync_cloud_tenants_with_tenants',
:zone => ems.my_zone
Expand Down
4 changes: 2 additions & 2 deletions app/models/manageiq/providers/cloud_manager/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def self.live_migrate_queue(userid, vm, options = {})
:userid => userid
}
queue_opts = {
:class_name => vm.class,
:class_name => vm.class.name,
:method_name => 'live_migrate',
:priority => MiqQueue::HIGH_PRIORITY,
:role => 'ems_operations',
Expand All @@ -253,7 +253,7 @@ def self.evacuate_queue(userid, vm, options = {})
:userid => userid
}
queue_opts = {
:class_name => vm.class,
:class_name => vm.class.name,
:method_name => 'evacuate',
:priority => MiqQueue::HIGH_PRIORITY,
:role => 'ems_operations',
Expand Down
2 changes: 1 addition & 1 deletion app/models/mixins/authentication_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def self.validate_credentials_task(args, user_id, zone)

queue_opts = {
:args => [*args],
:class_name => self,
:class_name => name,
:method_name => "raw_connect?",
:queue_name => "generic",
:role => "ems_operations",
Expand Down
6 changes: 3 additions & 3 deletions app/models/mixins/miq_provision_quota_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def quota_find_retired_vms_by_owner_and_group(options)
end

def quota_vm_stats(vms_method, options)
result = {:count => 0, :memory => 0, :cpu => 0, :snapshot_storage => 0, :used_storage => 0, :allocated_storage => 0, :ids => [], :class_name => Vm.name}
result = {:count => 0, :memory => 0, :cpu => 0, :snapshot_storage => 0, :used_storage => 0, :allocated_storage => 0, :ids => [], :class_name => "Vm"}
vms = send(vms_method, options)
result[:count] = vms.length
vms.each do |vm|
Expand Down Expand Up @@ -330,9 +330,9 @@ def bundle_quota_values(service_resource, result)
end

def quota_provision_stats(prov_method, options)
result = {:count => 0, :memory => 0, :cpu => 0, :storage => 0, :ids => [], :class_name => MiqProvisionRequest.name,
result = {:count => 0, :memory => 0, :cpu => 0, :storage => 0, :ids => [], :class_name => "MiqProvisionRequest",
:active => {
:class_name => MiqProvision.name, :ids => [], :storage_by_id => Hash.new { |k, v| k[v] = 0 },
:class_name => "MiqProvision", :ids => [], :storage_by_id => Hash.new { |k, v| k[v] = 0 },
Copy link
Member Author

@jrafanie jrafanie May 30, 2019

Choose a reason for hiding this comment

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

A bonus change that doesn't raise the deprecation but prevents autoload here and the above two places.

:memory_by_host_id => Hash.new { |k, v| k[v] = 0 }, :cpu_by_host_id => Hash.new { |k, v| k[v] = 0 },
:vms_by_storage_id => Hash.new { |k, v| k[v] = [] }
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/service_template_transformation_plan_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def transformation_log_queue(userid = nil, log_type = 'v2v')

_log.info("Queuing the download of #{log_type} log for #{description} with ID [#{id}]")
task_options = {:userid => userid, :action => 'transformation_log'}
queue_options = {:class_name => self.class,
queue_options = {:class_name => self.class.name,
:method_name => 'transformation_log',
:instance_id => id,
:args => [log_type],
Expand Down
2 changes: 1 addition & 1 deletion spec/models/mixins/authentication_mixin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def self.name; "TestClass"; end
let(:queue_opts) do
{
:args => [*args],
:class_name => ExtManagementSystem,
:class_name => "ExtManagementSystem",
:method_name => "raw_connect?",
:queue_name => "generic",
:role => "ems_operations",
Expand Down