Skip to content

Commit

Permalink
B #1710: fix bug when parent_id is empty (#3405)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7dc16bf)
  • Loading branch information
Alejandro Huertas Herrero authored and rsmontero committed Jun 5, 2019
1 parent abdd5d0 commit 29ff8d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/onedb/fsck/quotas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,13 @@ def calculate_vnet_quotas(doc, queries, resource)
vnet_doc.xpath('VNET/AR_POOL').each do |ar|
parent_id = ar.xpath('AR/PARENT_NETWORK_AR_ID')
parent_id = parent_id.text unless parent_id.nil?
size = ar.xpath('AR/SIZE').text.to_i

if !parent_id.nil?
vnet_usage[parent_id] = 0 if vnet_usage[parent_id].nil?
vnet_usage[parent_id] += size
next if parent_id.nil? || parent_id.empty?

vnet_usage[parent_id] = 0 if vnet_usage[parent_id].nil?

ar.xpath('AR/SIZE').each do |size|
vnet_usage[parent_id] += size.text.to_i
end
end
end
Expand Down

0 comments on commit 29ff8d8

Please sign in to comment.