Skip to content

Commit

Permalink
Merge pull request #14816 from zeari/fix_nil_images_in_chargeback
Browse files Browse the repository at this point in the history
group chargeback with unknown image under 'unknown image'
  • Loading branch information
isimluk authored Apr 20, 2017
2 parents f6b90aa + c541d66 commit 993774e
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 993774e

Please sign in to comment.