Documentation ¶
Index ¶
- func ApplyFilePermissions(fromPath, toPath string) error
- func CopyFile(fromPath, toPath string) error
- func EntityDirectory() string
- func Getent(databaseFile string, predicate func([]string) bool) ([]string, error)
- func IsFileInfoASymbolicLink(fileInfo os.FileInfo) bool
- func IsManageableFile(path string) bool
- func IsManageableFileInfo(info os.FileInfo) bool
- func MoveFile(fromPath, toPath string) error
- func ProvisionedDirectory() string
- func RepoDirectory() string
- func ScanDirectory(path string, predicate func(fi os.FileInfo) bool) ([]string, error)
- func ScriptDirectory() string
- func TargetBaseDirectory() string
- func TargetDirectory() string
- type Entities
- type Entity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFilePermissions ¶
ApplyFilePermissions applies permission flags and ownership from the first file to the second file.
func EntityDirectory ¶
func EntityDirectory() string
EntityDirectory is derived from the TargetDirectory() as "$target_dir/usr/share/holo".
func Getent ¶
Getent reads entries from a UNIX user/group database (e.g. /etc/passwd or /etc/group) and returns the first entry matching the given predicate. For example, to locate the user with name "foo":
fields, err := Getent("/etc/passwd", func(fields []string) bool { return fields[0] == "foo" })
func IsFileInfoASymbolicLink ¶
IsFileInfoASymbolicLink returns whether the given FileInfo describes a symlink.
func IsManageableFile ¶
IsManageableFile returns whether the file can be managed by Holo (i.e. is a regular file or a symlink).
func IsManageableFileInfo ¶ added in v0.9.0
IsManageableFileInfo returns whether the given FileInfo refers to a manageable file (i.e. a regular file or a symlink).
func ProvisionedDirectory ¶
func ProvisionedDirectory() string
ProvisionedDirectory is derived from the TargetDirectory() as "$target_dir/var/lib/holo/provisioned".
func RepoDirectory ¶
func RepoDirectory() string
RepoDirectory is derived from the TargetDirectory() as "$target_dir/usr/share/holo/repo".
func ScanDirectory ¶ added in v0.9.0
ScanDirectory reads the directory at path and returns the full paths of all files in it that match the given predicate. No recursive walking of subdirectories is performed. The result slice is sorted by file name.
func ScriptDirectory ¶ added in v0.9.0
func ScriptDirectory() string
ScriptDirectory is derived from the TargetDirectory() as "$target_dir/usr/share/holo/provision".
func TargetBaseDirectory ¶
func TargetBaseDirectory() string
TargetBaseDirectory is derived from the TargetDirectory() as "$target_dir/var/lib/holo/base".
func TargetDirectory ¶
func TargetDirectory() string
TargetDirectory is usually the root directory "/" and can be set with the environment variable HOLO_CHROOT_DIR (usually only within unit tests).
Types ¶
type Entities ¶
type Entities []Entity
Entities holds a slice of Entity instances, and implements some methods to satisfy the sort.Interface interface.
type Entity ¶
type Entity interface { //EntityID returns a string that uniquely identifies the entity, usually in //the form "type:name". This is how the entity can be addressed as a target //in the argument list for "holo apply", e.g. "holo apply /etc/sudoers //group:foo" will apply the target file "/etc/sudoers" and the group "foo". //Therefore, entity IDs should not contain whitespaces or characters that //have a special meaning on the shell. EntityID() string //Report generates a Report describing this Entity. Report() *shared.Report //Apply performs the complete application algorithm for the given Entity. Apply(withForce bool) //RenderDiff creates a unified diff between the current and last //provisioned version of this entity. For files, the output is always a //patch that can be applied on the last provisioned version to obtain the //current state. RenderDiff() ([]byte, error) }
Entity provides a common interface for configuration entities, such as configuration files, user accounts and user groups.