Documentation ¶
Index ¶
- Constants
- func ValidateRequired(val, path string) error
- func ValidateRequiredMany(vals []string, path string) error
- type BuildRouter
- type Builder
- type CmdRunTask
- type CmdRunTaskBuilder
- type CmdRunTaskExecutor
- type ExecutionResult
- type Executor
- type ExecutorRouter
- type FileManagedTask
- type FileManagedTaskBuilder
- type FileManagedTaskExecutor
- type FsManager
- type HashManager
- type NamedTask
- type PackageManager
- type PkgActionType
- type PkgTask
- type PkgTaskBuilder
- type PkgTaskExecutor
- type Script
- type Scripts
- type Task
Constants ¶
View Source
const ( TaskTypeCmdRun = "cmd.run" FileManaged = "file.managed" PkgInstalled = "pkg.installed" PkgRemoved = "pkg.removed" PkgUpgraded = "pkg.uptodate" NameField = "name" NamesField = "names" CwdField = "cwd" UserField = "user" ShellField = "shell" EnvField = "env" CreatesField = "creates" RequireField = "require" OnlyIf = "onlyif" Unless = "unless" SourceField = "source" SourceHashField = "source_hash" MakeDirsField = "makedirs" ReplaceField = "replace" SkipVerifyField = "skip_verify" ContentsField = "contents" GroupField = "group" ModeField = "mode" EncodingField = "encoding" Version = "version" Refresh = "refresh" )
View Source
const DefaultFileMode = 0744
Variables ¶
This section is empty.
Functions ¶
func ValidateRequired ¶
func ValidateRequiredMany ¶
Types ¶
type BuildRouter ¶
func NewBuilderRouter ¶
func NewBuilderRouter(builders map[string]Builder) BuildRouter
type CmdRunTask ¶
type CmdRunTask struct { TypeName string Path string NamedTask WorkingDir string User string Shell string Envs conv.KeyValues MissingFilesCondition []string Require []string OnlyIf []string Unless []string }
func (*CmdRunTask) GetName ¶
func (crt *CmdRunTask) GetName() string
func (*CmdRunTask) GetPath ¶
func (crt *CmdRunTask) GetPath() string
func (*CmdRunTask) GetRequirements ¶
func (crt *CmdRunTask) GetRequirements() []string
func (*CmdRunTask) String ¶
func (crt *CmdRunTask) String() string
func (*CmdRunTask) Validate ¶
func (crt *CmdRunTask) Validate() error
type CmdRunTaskBuilder ¶
type CmdRunTaskBuilder struct { }
type CmdRunTaskExecutor ¶
func (*CmdRunTaskExecutor) Execute ¶
func (crte *CmdRunTaskExecutor) Execute(ctx context.Context, task Task) ExecutionResult
type ExecutionResult ¶
type ExecutionResult struct { Err error Duration time.Duration StdErr string StdOut string IsSkipped bool SkipReason string Pids []int }
func (*ExecutionResult) String ¶
func (tr *ExecutionResult) String() string
func (*ExecutionResult) Succeeded ¶
func (tr *ExecutionResult) Succeeded() bool
returns true if task succeeded or was skipped
type ExecutorRouter ¶
func (ExecutorRouter) GetExecutor ¶
func (er ExecutorRouter) GetExecutor(task Task) (Executor, error)
type FileManagedTask ¶
type FileManagedTask struct { MakeDirs bool Replace bool SkipVerify bool SkipTLSCheck bool Mode os.FileMode TypeName string Path string Name string SourceHash string Contents sql.NullString User string Group string Encoding string Source utils.Location Creates []string OnlyIf []string Require []string }
func (*FileManagedTask) GetName ¶
func (crt *FileManagedTask) GetName() string
func (*FileManagedTask) GetPath ¶
func (crt *FileManagedTask) GetPath() string
func (*FileManagedTask) GetRequirements ¶
func (crt *FileManagedTask) GetRequirements() []string
func (*FileManagedTask) String ¶
func (crt *FileManagedTask) String() string
func (*FileManagedTask) Validate ¶
func (crt *FileManagedTask) Validate() error
type FileManagedTaskBuilder ¶
type FileManagedTaskBuilder struct { }
type FileManagedTaskExecutor ¶
type FileManagedTaskExecutor struct { FsManager FsManager HashManager HashManager Runner exec2.Runner }
func (*FileManagedTaskExecutor) Execute ¶
func (fmte *FileManagedTaskExecutor) Execute(ctx context.Context, task Task) ExecutionResult
type FsManager ¶
type FsManager interface { FileExists(filePath string) (bool, error) Remove(filePath string) error DownloadFile(ctx context.Context, targetLocation string, sourceURL *url.URL, skipTLSCheck bool) error MoveFile(sourceFilePath, targetFilePath string) error CopyLocalFile(sourceFilePath, targetFilePath string, mode os.FileMode) error WriteFile(name, contents string, mode os.FileMode) error ReadFile(filePath string) (content string, err error) CreateDirPathIfNeeded(targetFilePath string, mode os.FileMode) error Chmod(targetFilePath string, mode os.FileMode) error Chown(targetFilePath string, userName, groupName string) error Stat(name string) (os.FileInfo, error) ReadEncodedFile(encodingName, fileName string) (contentsUtf8 string, err error) }
type HashManager ¶
type PackageManager ¶
type PkgActionType ¶
type PkgActionType int
const ( ActionInstall PkgActionType = iota + 1 ActionUninstall ActionUpdate )
type PkgTask ¶
type PkgTask struct { ActionType PkgActionType TypeName string Path string NamedTask Shell string Version string ShouldRefresh bool Require []string OnlyIf []string Unless []string }
func (*PkgTask) GetRequirements ¶
type PkgTaskBuilder ¶
type PkgTaskBuilder struct { }
type PkgTaskExecutor ¶
type PkgTaskExecutor struct { PackageManager PackageManager Runner exec2.Runner }
func (*PkgTaskExecutor) Execute ¶
func (pte *PkgTaskExecutor) Execute(ctx context.Context, task Task) ExecutionResult
Click to show internal directories.
Click to hide internal directories.