Skip to content

Commit

Permalink
Refactor volume#to_xml to please RuboCop
Browse files Browse the repository at this point in the history
Fixes: 476c630 ("Always use XML builders to construct XML")
  • Loading branch information
ekohl committed Jul 15, 2024
1 parent 476c630 commit ef380f8
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions lib/fog/libvirt/models/compute/volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,14 @@ def to_xml

xml.target do
xml.format(:type => format_type)

xml.permissions do
xml.owner(owner) if owner
xml.group(group) if group
xml.mode('0744')
xml.label('virt_image_t')
end
xml_permissions(xml)
end

if backing_volume
xml.backingStore do
xml.path(backing_volume.path)
xml.format(:type => backing_volume.format_type)

xml.permissions do
xml.owner(owner) if owner
xml.group(group) if group
xml.mode('0744')
xml.label('virt_image_t')
end
xml_permissions(xml)
end
end
end
Expand All @@ -122,6 +110,15 @@ def to_xml

private

def xml_permissions(xml)
xml.permissions do
xml.owner(owner) if owner
xml.group(group) if group
xml.mode('0744')
xml.label('virt_image_t')
end
end

def image_suffix
return "img" if format_type == "raw"
format_type
Expand Down

0 comments on commit ef380f8

Please sign in to comment.