Files
warewulf/internal/pkg/config/mounts.go
Jonathon Anderson e80c639b11 Convert config to *bool
Supports leaving booleans unspecified in YAML.

Boolean methods allow the templates to continue using previous names for
boolean values.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-11 00:09:48 -07:00

24 lines
637 B
Go

package config
import (
"github.com/warewulf/warewulf/internal/pkg/util"
)
// A MountEntry represents a bind mount that is applied to a container
// during exec and shell.
type MountEntry struct {
Source string `yaml:"source"`
Dest string `yaml:"dest,omitempty"`
ReadOnlyP *bool `yaml:"readonly,omitempty"`
Options string `yaml:"options,omitempty"` // ignored at the moment
CopyP *bool `yaml:"copy,omitempty"` // temporarily copy the file into the container
}
func (this MountEntry) ReadOnly() bool {
return util.BoolP(this.ReadOnlyP)
}
func (this MountEntry) Copy() bool {
return util.BoolP(this.CopyP)
}