diff --git a/app/models/automation_request.rb b/app/models/automation_request.rb index 0c2abf2c5b1..fcbed43f138 100644 --- a/app/models/automation_request.rb +++ b/app/models/automation_request.rb @@ -1,5 +1,6 @@ class AutomationRequest < MiqRequest - alias_attribute :automation_tasks, :miq_request_tasks + alias_method :automation_tasks, :miq_request_tasks + alias_method :automation_tasks=, :miq_request_tasks= TASK_DESCRIPTION = N_('Automation Request') DEFAULT_NAMESPACE = "SYSTEM" diff --git a/app/models/automation_task.rb b/app/models/automation_task.rb index 8f95e735492..af77843f729 100644 --- a/app/models/automation_task.rb +++ b/app/models/automation_task.rb @@ -1,5 +1,6 @@ class AutomationTask < MiqRequestTask - alias_attribute :automation_request, :miq_request + alias_method :automation_request, :miq_request + alias_method :automation_request=, :miq_request= AUTOMATE_DRIVES = false def self.get_description(_request_obj) diff --git a/app/models/manageiq/providers/embedded_automation_manager/authentication.rb b/app/models/manageiq/providers/embedded_automation_manager/authentication.rb index ce5447f5bc7..64f8705c05b 100644 --- a/app/models/manageiq/providers/embedded_automation_manager/authentication.rb +++ b/app/models/manageiq/providers/embedded_automation_manager/authentication.rb @@ -4,7 +4,8 @@ class ManageIQ::Providers::EmbeddedAutomationManager::Authentication < ManageIQ: # other models alias_attribute :manager_id, :resource_id - alias_attribute :manager, :resource + alias_method :manager, :resource + alias_method :manager=, :resource= after_create :set_manager_ref diff --git a/app/models/miq_provision.rb b/app/models/miq_provision.rb index 4e26f6750cf..55b10e67bcf 100644 --- a/app/models/miq_provision.rb +++ b/app/models/miq_provision.rb @@ -16,10 +16,13 @@ class MiqProvision < MiqProvisionTask include StateMachine include Tagging - alias_attribute :miq_provision_request, :miq_request # Legacy provisioning support - alias_attribute :provision_type, :request_type # Legacy provisioning support - alias_attribute :vm, :destination - alias_attribute :vm_template, :source + alias_method :miq_provision_request, :miq_request # Legacy provisioning support + alias_method :miq_provision_request=, :miq_request= # Legacy provisioning support + alias_attribute :provision_type, :request_type # Legacy provisioning support + alias_method :vm, :destination + alias_method :vm=, :destination= + alias_method :vm_template, :source + alias_method :vm_template=, :source= before_create :set_template_and_networking diff --git a/app/models/miq_provision_request.rb b/app/models/miq_provision_request.rb index 3ea31cbcef1..d786c021c18 100644 --- a/app/models/miq_provision_request.rb +++ b/app/models/miq_provision_request.rb @@ -1,9 +1,12 @@ class MiqProvisionRequest < MiqRequest - alias_attribute :vm_template, :source alias_attribute :provision_type, :request_type - alias_attribute :miq_provisions, :miq_request_tasks alias_attribute :src_vm_id, :source_id + alias_method :vm_template, :source + alias_method :vm_template=, :source= + alias_method :miq_provisions, :miq_request_tasks + alias_method :miq_provisions=, :miq_request_tasks= + delegate :my_zone, :to => :source TASK_DESCRIPTION = N_('VM Provisioning') diff --git a/app/models/persistent_volume.rb b/app/models/persistent_volume.rb index 1b805c0c322..9aefd937360 100644 --- a/app/models/persistent_volume.rb +++ b/app/models/persistent_volume.rb @@ -5,7 +5,8 @@ class PersistentVolume < ContainerVolume delegate :name, :to => :parent, :prefix => true, :allow_nil => true has_many :container_volumes, -> { where(:type => 'ContainerVolume') }, :through => :persistent_volume_claim has_many :parents, -> { distinct }, :through => :container_volumes, :source_type => 'ContainerGroup' - alias_attribute :container_groups, :parents + alias_method :container_groups, :parents + alias_method :container_groups=, :parents= virtual_attribute :parent_name, :string virtual_attribute :storage_capacity, :string diff --git a/app/models/physical_switch.rb b/app/models/physical_switch.rb index e426daddf87..68c1f19a8a5 100644 --- a/app/models/physical_switch.rb +++ b/app/models/physical_switch.rb @@ -18,7 +18,8 @@ class PhysicalSwitch < Switch :through => :connected_components, :source => :managed_entity - alias_attribute :physical_servers, :connected_physical_servers + alias_method :physical_servers, :connected_physical_servers + alias_method :physical_servers=, :connected_physical_servers= def my_zone ems = ext_management_system diff --git a/app/models/resource_group.rb b/app/models/resource_group.rb index 166bc17bb1c..df41f8befb1 100644 --- a/app/models/resource_group.rb +++ b/app/models/resource_group.rb @@ -1,6 +1,5 @@ class ResourceGroup < ApplicationRecord acts_as_miq_taggable - alias_attribute :images, :templates belongs_to :ext_management_system, :foreign_key => :ems_id @@ -13,4 +12,7 @@ class ResourceGroup < ApplicationRecord has_many :cloud_networks, :dependent => :nullify has_many :network_ports, :dependent => :nullify has_many :security_groups, :dependent => :nullify + + alias_method :images, :templates + alias_method :images=, :templates= end diff --git a/app/models/service.rb b/app/models/service.rb index d9c8dc56997..d86e173b73e 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -104,7 +104,10 @@ class Service < ApplicationRecord supports :retire alias parent_service parent - alias_attribute :service, :parent + + alias_method :service, :parent + alias_method :service=, :parent= + deprecate_attribute :display, :visible, :type => :boolean virtual_belongs_to :service diff --git a/app/models/service_template_provision_request.rb b/app/models/service_template_provision_request.rb index f964c6afdd4..3eeea246ed7 100644 --- a/app/models/service_template_provision_request.rb +++ b/app/models/service_template_provision_request.rb @@ -9,7 +9,8 @@ class ServiceTemplateProvisionRequest < MiqRequest after_create :process_service_order - alias_attribute :service_template, :source + alias_method :service_template, :source + alias_method :service_template=, :source= virtual_has_one :picture virtual_has_one :service_template diff --git a/app/models/vm_migrate_task.rb b/app/models/vm_migrate_task.rb index 4ce837a65af..a8a0c41a12d 100644 --- a/app/models/vm_migrate_task.rb +++ b/app/models/vm_migrate_task.rb @@ -1,5 +1,6 @@ class VmMigrateTask < MiqRequestTask - alias_attribute :vm, :source + alias_method :vm, :source + alias_method :vm=, :source= validate :validate_request_type, :validate_state default_value_for :request_type, "vm_migrate" diff --git a/app/models/vm_reconfigure_task.rb b/app/models/vm_reconfigure_task.rb index 8c4b07f6401..f1d806d17ef 100644 --- a/app/models/vm_reconfigure_task.rb +++ b/app/models/vm_reconfigure_task.rb @@ -1,5 +1,6 @@ class VmReconfigureTask < MiqRequestTask - alias_attribute :vm, :source + alias_method :vm, :source + alias_method :vm=, :source= validate :validate_request_type, :validate_state diff --git a/app/models/vm_retire_task.rb b/app/models/vm_retire_task.rb index 6d263c9032f..17cbfed6734 100644 --- a/app/models/vm_retire_task.rb +++ b/app/models/vm_retire_task.rb @@ -1,5 +1,6 @@ class VmRetireTask < MiqRetireTask - alias_attribute :vm, :source + alias_method :vm, :source + alias_method :vm=, :source= default_value_for :request_type, "vm_retire" def self.base_model