Skip to content

Commit

Permalink
group chargeback with unknown image under 'unknown image'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari Zellner committed Apr 19, 2017
1 parent 86e8b82 commit c541d66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/chargeback_container_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def self.build_results_for_report_ChargebackContainerImage(options)
end

@unknown_project ||= OpenStruct.new(:id => 0, :name => _('Unknown Project'), :ems_ref => _('Unknown'))
@unknown_image ||= OpenStruct.new(:id => 0, :full_name => _('Unknown Image'))
build_results_for_report_chargeback(options)
end

Expand All @@ -55,7 +56,7 @@ def self.default_key(metric_rollup_record, ts_key)
end

def self.image(consumption)
@data_index.fetch_path(:container_image, :by_container_id, consumption.resource_id)
@data_index.fetch_path(:container_image, :by_container_id, consumption.resource_id) || @unknown_image
end

def self.project(consumption)
Expand Down Expand Up @@ -90,8 +91,7 @@ def self.report_col_options

def init_extra_fields(consumption)
self.project_name = self.class.project(consumption).name
# until image archiving is implemented
self.image_name = self.class.image(consumption).try(:full_name) || _('Deleted')
self.image_name = self.class.image(consumption).try(:full_name)
self.project_uid = self.class.project(consumption).ems_ref
self.provider_name = consumption.parent_ems.try(:name)
self.provider_uid = consumption.parent_ems.try(:guid)
Expand Down

0 comments on commit c541d66

Please sign in to comment.