Skip to content

Commit

Permalink
Blacklist :namespace in several more places for convenience
Browse files Browse the repository at this point in the history
Tracking where it's ok to leave it in and where we must
`.delete(:namespace)` is too annoying...
  • Loading branch information
cben committed Jul 10, 2017
1 parent 4043d24 commit 37396e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ def initialize_inventory_collections(ems)
:secondary_refs => {:by_name => [:name]},
)
@inv_collections[:container_quotas] = ::ManagerRefresh::InventoryCollection.new(
:model_class => ContainerQuota,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_quotas,
#:arel => ContainerQuota.joins(:container_project).where(:container_projects => {:ems_id => ems.id}),
:model_class => ContainerQuota,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_quotas,
:attributes_blacklist => [:namespace],
)
@inv_collections[:container_quota_items] = ::ManagerRefresh::InventoryCollection.new(
:model_class => ContainerQuotaItem,
:parent => ems,
:association => :container_quota_items,
#:arel => ContainerQuotaItem.joins(:container_quota => :container_project).where(:container_projects => {:ems_id => ems.id}),
:manager_ref => [:container_quota, :resource],
)
@inv_collections[:container_limits] = ::ManagerRefresh::InventoryCollection.new(
:model_class => ContainerLimit,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_limits,
:model_class => ContainerLimit,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_limits,
:attributes_blacklist => [:namespace],
)
@inv_collections[:container_limit_items] = ::ManagerRefresh::InventoryCollection.new(
:model_class => ContainerLimitItem,
Expand Down Expand Up @@ -189,10 +189,11 @@ def initialize_inventory_collections(ems)
)
@inv_collections[:container_templates] =
::ManagerRefresh::InventoryCollection.new(
:model_class => ContainerTemplate,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_templates,
:model_class => ContainerTemplate,
:parent => ems,
:builder_params => {:ems_id => ems.id},
:association => :container_templates,
:attributes_blacklist => [:namespace],
)
@inv_collections[:container_template_parameters] =
::ManagerRefresh::InventoryCollection.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_resource_quotas_graph(inv)
inv["resource_quota"].each do |quota|
h = parse_resource_quota(quota)

h[:container_project] = lazy_find_project(:name => h.delete(:namespace))
h[:container_project] = lazy_find_project(:name => h[:namespace])

items = h.delete(:container_quota_items)
get_container_quota_items_graph(h, items)
Expand All @@ -310,7 +310,7 @@ def get_limit_ranges_graph(inv)
inv["limit_range"].each do |data|
h = parse_range(data)

h[:container_project] = lazy_find_project(:name => h.delete(:namespace))
h[:container_project] = lazy_find_project(:name => h[:namespace])
items = h.delete(:container_limit_items)

limit = collection.build(h)
Expand Down

0 comments on commit 37396e9

Please sign in to comment.