blueprint: add filesystem customisations support
This commit is contained in:
parent
700afb5af9
commit
d0e4558b2b
2 changed files with 40 additions and 9 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue