Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Nov 15, 2024
1 parent 1047992 commit 03f1590
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
# find current contact information at www.suse.com.

require "agama/storage/config_conversions/to_model_conversions/base"
# require "agama/storage/config_conversions/to_model_conversions/with_encryption"
require "agama/storage/config_conversions/to_model_conversions/with_filesystem"
require "agama/storage/config_conversions/to_model_conversions/with_size"
require "agama/storage/configs/partition"

module Agama
Expand All @@ -30,8 +30,8 @@ module ConfigConversions
module ToModelConversions
# Partition conversion to JSON hash according to schema.
class Partition < Base
# include WithEncryption
include WithFilesystem
include WithSize

# @see Base
def self.config_type
Expand All @@ -48,13 +48,25 @@ def conversions
id: config.id&.to_s,
mountPath: config.filesystem&.path,
filesystem: convert_filesystem,
# size: convert_size,
size: convert_size,
delete: config.delete?,
deleteIfNeeded: config.delete_if_needed?,
# resize: convert_resize,
# resizeIfNeeded: convert_resize_if_needed
resize: convert_resize,
resizeIfNeeded: convert_resize_if_needed
}
end

def convert_resize
size = config.size

!size.nil? && !size.default? && size.min == size.max
end

def convert_resize_if_needed
size = config.size

!size.nil? && !size.default? && size.min != size.max
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def resize_partition?
end

def search_all?(partition_config)
partition_config.search &&
!partition_config.search.nil? &&
partition_config.search.always_match? &&
partition_config.search.max.nil?
end

def shrink_all?(partition_config)
partition_config.size && partition_config.size.min.to_i == 0
!partition_config.size.nil? && partition_config.size.min.to_i == 0
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
drives: [
{
partitions: [
{ search: "*", size: "1 GiB", deleteIfNeeded: true },
{ search: "*", size: { min: 3 }, deleteIfNeeded: true },
{
alias: "root",
id: "linux",
Expand Down

0 comments on commit 03f1590

Please sign in to comment.