Skip to content

Commit

Permalink
Merge pull request #17082 from lpichler/fix_service_uniqueness
Browse files Browse the repository at this point in the history
Add uniqueness of service for generation chargeback report for SSUI
(cherry picked from commit c2f76b6)

https://bugzilla.redhat.com/show_bug.cgi?id=1552817
  • Loading branch information
gtanzillo authored and simaishi committed Mar 7, 2018
1 parent aa6f8d8 commit a75d746
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/service.rb
Expand Up @@ -370,11 +370,11 @@ def self.queue_chargeback_reports(options = {})
end

def chargeback_report_name
"Chargeback-Vm-Monthly-#{name}"
"Chargeback-Vm-Monthly-#{name}-#{id}"
end

def generate_chargeback_report(options = {})
_log.info("Generation of chargeback report for service #{name} started...")
_log.info("Generation of chargeback report for service #{name} with #{id} started...")
MiqReportResult.where(:name => chargeback_report_name).destroy_all
report = MiqReport.new(chargeback_yaml)
options[:report_sync] = true
Expand Down
2 changes: 1 addition & 1 deletion spec/models/service_spec.rb
Expand Up @@ -429,7 +429,7 @@

describe "#chargeback_report_name" do
it "creates chargeback report's name" do
expect(@service.chargeback_report_name).to eq "Chargeback-Vm-Monthly-Test_Service_1"
expect(@service.chargeback_report_name).to eq "Chargeback-Vm-Monthly-Test_Service_1-#{@service.id}"
end
end

Expand Down

0 comments on commit a75d746

Please sign in to comment.