Skip to content

Commit

Permalink
Move export_subvolume to autopart.rb helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Oct 25, 2016
1 parent 8f656d3 commit beb303f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
20 changes: 18 additions & 2 deletions src/include/autoinstall/autopart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ def AddSubvolData(st_map, xml_map)
deep_copy(ret)
end

# Build a subvolume definition
# Build a subvolume representation from a definition
#
# This method support two kind of subvolume specification:
# This method is suitable to import an AutoYaST profile.
# It supports two kind of subvolume specification:
#
# * just a name
# * or a hash containing a "name" and an optional "options" keys
Expand Down Expand Up @@ -77,6 +78,21 @@ def import_subvolume(spec_or_name, prefix = "")
subvolume.merge(Hash[options])
end

# Build a subvolume specification from the current definition
#
# The result is suitable to be used to generate an AutoYaST profile.
#
# @param subvolume [Hash] Subvolume definition (internal storage layer definition)
# @param prefix [String] Subvolume prefix (usually default subvolume + '/')
# @return [Hash] External representation of a subvolume (e.g. to be used by AutoYaST)
def export_subvolume(subvolume, prefix = "")
subvolume_spec = {
"name" => subvolume["name"].sub(/\A#{prefix}/, "")
}
subvolume_spec["options"] = "nocow" if subvolume["nocow"]
subvolume_spec
end

def AddFilesysData(st_map, xml_map)
st_map = deep_copy(st_map)
xml_map = deep_copy(xml_map)
Expand Down
14 changes: 1 addition & 13 deletions src/modules/AutoinstPartPlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def main
Yast.import "UI"
textdomain "autoinst"

Yast.include self, "autoinstall/autopart.rb"
Yast.include self, "autoinstall/types.rb"
Yast.include self, "autoinstall/common.rb"
Yast.include self, "autoinstall/tree.rb"
Expand Down Expand Up @@ -1086,19 +1087,6 @@ def deletePartition(driveId, partitionIdx)
end
end

# Build a subvolume specification from the current definition
#
# @param subvolume [Hash] Subvolume definition (internal storage layer definition)
# @param prefix [String] Subvolume prefix (usually default subvolume + '/')
# @return [Hash] External representation of a subvolume (e.g. to be used by AutoYaST)
def export_subvolume(subvolume, prefix = "")
subvolume_spec = {
"name" => subvolume["name"].sub(/\A#{prefix}/, "")
}
subvolume_spec["options"] = "nocow" if subvolume["nocow"]
subvolume_spec
end

publish :function => :SetModified, :type => "void ()"
publish :function => :GetModified, :type => "boolean ()"
publish :function => :updateTree, :type => "void ()"
Expand Down

0 comments on commit beb303f

Please sign in to comment.