diff --git a/internal/blueprint/customizations.go b/internal/blueprint/customizations.go index ad88c51f9..8984360b8 100644 --- a/internal/blueprint/customizations.go +++ b/internal/blueprint/customizations.go @@ -1,15 +1,16 @@ package blueprint type Customizations struct { - Hostname *string `json:"hostname,omitempty" toml:"hostname,omitempty"` - Kernel *KernelCustomization `json:"kernel,omitempty" toml:"kernel,omitempty"` - SSHKey []SSHKeyCustomization `json:"sshkey,omitempty" toml:"sshkey,omitempty"` - User []UserCustomization `json:"user,omitempty" toml:"user,omitempty"` - Group []GroupCustomization `json:"group,omitempty" toml:"group,omitempty"` - Timezone *TimezoneCustomization `json:"timezone,omitempty" toml:"timezone,omitempty"` - Locale *LocaleCustomization `json:"locale,omitempty" toml:"locale,omitempty"` - Firewall *FirewallCustomization `json:"firewall,omitempty" toml:"firewall,omitempty"` - Services *ServicesCustomization `json:"services,omitempty" toml:"services,omitempty"` + Hostname *string `json:"hostname,omitempty" toml:"hostname,omitempty"` + Kernel *KernelCustomization `json:"kernel,omitempty" toml:"kernel,omitempty"` + SSHKey []SSHKeyCustomization `json:"sshkey,omitempty" toml:"sshkey,omitempty"` + User []UserCustomization `json:"user,omitempty" toml:"user,omitempty"` + Group []GroupCustomization `json:"group,omitempty" toml:"group,omitempty"` + Timezone *TimezoneCustomization `json:"timezone,omitempty" toml:"timezone,omitempty"` + Locale *LocaleCustomization `json:"locale,omitempty" toml:"locale,omitempty"` + Firewall *FirewallCustomization `json:"firewall,omitempty" toml:"firewall,omitempty"` + Services *ServicesCustomization `json:"services,omitempty" toml:"services,omitempty"` + Filesystem []FilesystemCustomization `json:"filesystem,omitempty" toml:"filesystem,omitempty"` } type KernelCustomization struct { @@ -64,6 +65,11 @@ type ServicesCustomization struct { Disabled []string `json:"disabled,omitempty" toml:"disabled,omitempty"` } +type FilesystemCustomization struct { + Mountpoint string `json:"mountpoint,omitempty" toml:"mountpoint,omitempty"` + MinSize int `json:"minsize,omitempty" toml:"size,omitempty"` +} + type CustomizationError struct { Message string } @@ -187,3 +193,10 @@ func (c *Customizations) GetServices() *ServicesCustomization { return c.Services } + +func (c *Customizations) GetFilesystems() []FilesystemCustomization { + if c == nil { + return nil + } + return c.Filesystem +} diff --git a/internal/blueprint/customizations_test.go b/internal/blueprint/customizations_test.go index 8415dc473..0cbcd9df0 100644 --- a/internal/blueprint/customizations_test.go +++ b/internal/blueprint/customizations_test.go @@ -267,3 +267,21 @@ func TestNilGetTimezoneSettings(t *testing.T) { assert.Nil(t, retTimezone) assert.Nil(t, retNTPServers) } + +func TestGetFilesystems(t *testing.T) { + + expectedFilesystems := []FilesystemCustomization{ + { + MinSize: 1024, + Mountpoint: "/", + }, + } + + TestCustomizations := Customizations{ + Filesystem: expectedFilesystems, + } + + retFilesystems := TestCustomizations.GetFilesystems() + + assert.ElementsMatch(t, expectedFilesystems, retFilesystems) +}