Skip to content

Commit

Permalink
Change to generic name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladas committed Aug 24, 2018
1 parent 1b86cae commit 09c4ae5
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 34 deletions.
3 changes: 0 additions & 3 deletions app/models/container_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class ContainerProject < ApplicationRecord
has_many :container_limits
has_many :container_limit_items, :through => :container_limits
has_many :container_builds
has_many :container_service_classes, :dependent => :nullify
has_many :container_service_instances, :dependent => :nullify
has_many :container_service_plans, :dependent => :nullify
has_many :container_templates
has_many :archived_container_groups, :foreign_key => "old_container_project_id", :class_name => "ContainerGroup"
has_many :persistent_volume_claims
Expand Down
9 changes: 0 additions & 9 deletions app/models/container_service_class.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/container_service_instance.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/models/container_service_plan.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def self.api_allowed_attributes
has_many :miq_events, :as => :target, :dependent => :destroy
has_many :cloud_subnets, :foreign_key => :ems_id, :dependent => :destroy

has_many :service_classes, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system
has_many :service_instances, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system
has_many :service_plans, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system

validates :name, :presence => true, :uniqueness => {:scope => [:tenant_id]}
validates :hostname, :presence => true, :if => :hostname_required?
validate :hostname_uniqueness_valid?, :hostname_format_valid?, :if => :hostname_required?
Expand Down
3 changes: 0 additions & 3 deletions app/models/manageiq/providers/container_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class ContainerManager < BaseManager
has_many :container_builds, :foreign_key => :ems_id, :dependent => :destroy
has_many :container_build_pods, :foreign_key => :ems_id, :dependent => :destroy
has_many :container_templates, :foreign_key => :ems_id, :dependent => :destroy
has_many :container_service_classes, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system
has_many :container_service_instances, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system
has_many :container_service_plans, :foreign_key => :ems_id, :dependent => :destroy, :inverse_of => :ext_management_system
has_one :container_deployment, :foreign_key => :deployed_ems_id, :inverse_of => :deployed_ems

# Shortcuts to chained joins, mostly used by inventory refresh.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,23 @@ def persistent_volume_claims
add_common_default_values
end

def container_service_classes
def service_classes
add_properties(
:model_class => ::ContainerServiceClass,
:model_class => ::ServiceClass,
)
add_common_default_values
end

def container_service_plans
add_properties(
:model_class => ::ContainerServicePlan,
:model_class => ::ServicePlan,
)
add_common_default_values
end

def container_service_instances
add_properties(
:model_class => ::ContainerServiceInstance,
:model_class => ::ServiceInstance,
)
add_common_default_values
end
Expand Down
7 changes: 7 additions & 0 deletions app/models/service_class.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ServiceClass < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id", :inverse_of => :service_classes
belongs_to :service_broker

has_many :service_plans, :dependent => :nullify
has_many :service_instances, :dependent => :nullify
end
5 changes: 5 additions & 0 deletions app/models/service_instance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ServiceInstance < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id", :inverse_of => :service_instances
belongs_to :service_class
belongs_to :service_plan
end
6 changes: 6 additions & 0 deletions app/models/service_plan.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class ServicePlan < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id", :inverse_of => :service_plans
belongs_to :service_class

has_many :service_instances, :dependent => :nullify
end

0 comments on commit 09c4ae5

Please sign in to comment.