Documentation
¶
Index ¶
- Constants
- Variables
- type Action
- type Command
- func (c *Command) AddAction(action *Action)
- func (c *Command) GetCmdline() string
- func (c *Command) GetCmdlineArgs() []string
- func (c *Command) GetProp(name string) interface{}
- func (c *Command) HasProp(name string) bool
- func (c *Command) Index() int
- func (c *Command) SetProp(name string, value interface{})
- type Recipe
- type TokenInfo
- type Variable
Constants ¶
View Source
const ( KEYWORD_VAR = "var" KEYWORD_COMMAND = "command" KEYWORD_PACKAGE = "pkg" OPTION_UNSAFE_ACTIONS = "unsafe-actions" OPTION_REQUIRE_ROOT = "require-root" OPTION_FAST_FINISH = "fast-finish" OPTION_LOCK_WORKDIR = "lock-workdir" OPTION_DELAY = "delay" ACTION_EXIT = "exit" ACTION_WAIT = "wait" ACTION_EXPECT = "expect" ACTION_WAIT_OUTPUT = "wait-output" ACTION_OUTPUT_MATCH = "output-match" ACTION_OUTPUT_CONTAINS = "output-contains" ACTION_OUTPUT_TRIM = "output-trim" ACTION_PRINT = "print" ACTION_CHDIR = "chdir" ACTION_MODE = "mode" ACTION_OWNER = "owner" ACTION_EXIST = "exist" ACTION_READABLE = "readable" ACTION_WRITABLE = "writable" ACTION_EXECUTABLE = "executable" ACTION_DIR = "dir" ACTION_EMPTY = "empty" ACTION_EMPTY_DIR = "empty-dir" ACTION_CHECKSUM = "checksum" ACTION_CHECKSUM_READ = "checksum-read" ACTION_FILE_CONTAINS = "file-contains" ACTION_COPY = "copy" ACTION_MOVE = "move" ACTION_TOUCH = "touch" ACTION_MKDIR = "mkdir" ACTION_REMOVE = "remove" ACTION_CHMOD = "chmod" ACTION_BACKUP = "backup" ACTION_BACKUP_RESTORE = "backup-restore" ACTION_PROCESS_WORKS = "process-works" ACTION_WAIT_PID = "wait-pid" ACTION_WAIT_FS = "wait-fs" ACTION_CONNECT = "connect" ACTION_APP = "app" ACTION_SIGNAL = "signal" ACTION_ENV = "env" ACTION_ENV_SET = "env-set" ACTION_USER_EXIST = "user-exist" ACTION_USER_ID = "user-id" ACTION_USER_GID = "user-gid" ACTION_USER_GROUP = "user-group" ACTION_USER_SHELL = "user-shell" ACTION_USER_HOME = "user-home" ACTION_GROUP_EXIST = "group-exist" ACTION_GROUP_ID = "group-id" ACTION_SERVICE_PRESENT = "service-present" ACTION_SERVICE_ENABLED = "service-enabled" ACTION_SERVICE_WORKS = "service-works" ACTION_HTTP_STATUS = "http-status" ACTION_HTTP_HEADER = "http-header" ACTION_HTTP_CONTAINS = "http-contains" ACTION_HTTP_JSON = "http-json" ACTION_HTTP_SET_AUTH = "http-set-auth" ACTION_HTTP_SET_HEADER = "http-set-header" ACTION_LIB_LOADED = "lib-loaded" ACTION_LIB_HEADER = "lib-header" ACTION_LIB_CONFIG = "lib-config" ACTION_LIB_EXIST = "lib-exist" ACTION_LIB_LINKED = "lib-linked" ACTION_PYTHON_MODULE = "python-module" ACTION_PYTHON3_MODULE = "python3-module" )
View Source
const MAX_VAR_NESTING = 32
MAX_VAR_NESTING maximum variables nesting
Variables ¶
View Source
var DynamicVariables = []string{
"WORKDIR",
"TIMESTAMP",
"DATE",
"HOSTNAME",
"IP",
"PYTHON_SITELIB",
"PYTHON2_SITELIB",
"PYTHON_SITEARCH",
"PYTHON2_SITEARCH",
"PYTHON3_SITELIB",
"PYTHON3_SITEARCH",
"PYTHON_SITELIB_LOCAL",
"PYTHON2_SITELIB_LOCAL",
"PYTHON3_SITELIB_LOCAL",
"PYTHON_SITEARCH_LOCAL",
"PYTHON2_SITEARCH_LOCAL",
"PYTHON3_SITEARCH_LOCAL",
"ERLANG_BIN_DIR",
}
DynamicVariables contains list of dynamic variables
View Source
var Tokens = []TokenInfo{ {KEYWORD_VAR, 2, 2, true, false}, {KEYWORD_COMMAND, 1, 2, true, false}, {KEYWORD_PACKAGE, 1, 999, true, false}, {OPTION_UNSAFE_ACTIONS, 1, 1, true, false}, {OPTION_REQUIRE_ROOT, 1, 1, true, false}, {OPTION_FAST_FINISH, 1, 1, true, false}, {OPTION_LOCK_WORKDIR, 1, 1, true, false}, {OPTION_DELAY, 1, 1, true, false}, {ACTION_EXIT, 1, 2, false, true}, {ACTION_WAIT, 1, 1, false, false}, {ACTION_EXPECT, 1, 2, false, false}, {ACTION_WAIT_OUTPUT, 1, 1, false, false}, {ACTION_OUTPUT_MATCH, 1, 1, false, true}, {ACTION_OUTPUT_CONTAINS, 1, 1, false, true}, {ACTION_OUTPUT_TRIM, 0, 0, false, false}, {ACTION_PRINT, 1, 1, false, false}, {ACTION_CHDIR, 1, 1, false, false}, {ACTION_MODE, 2, 2, false, true}, {ACTION_OWNER, 2, 2, false, true}, {ACTION_EXIST, 1, 1, false, true}, {ACTION_READABLE, 2, 2, false, true}, {ACTION_WRITABLE, 2, 2, false, true}, {ACTION_EXECUTABLE, 2, 2, false, true}, {ACTION_DIR, 1, 1, false, true}, {ACTION_EMPTY, 1, 1, false, true}, {ACTION_EMPTY_DIR, 1, 1, false, true}, {ACTION_CHECKSUM, 2, 2, false, true}, {ACTION_CHECKSUM_READ, 2, 2, false, false}, {ACTION_FILE_CONTAINS, 2, 2, false, true}, {ACTION_COPY, 2, 2, false, false}, {ACTION_MOVE, 2, 2, false, false}, {ACTION_TOUCH, 1, 1, false, false}, {ACTION_MKDIR, 1, 1, false, false}, {ACTION_REMOVE, 1, 1, false, false}, {ACTION_CHMOD, 2, 2, false, false}, {ACTION_BACKUP, 1, 1, false, false}, {ACTION_BACKUP_RESTORE, 1, 1, false, false}, {ACTION_PROCESS_WORKS, 1, 1, false, true}, {ACTION_WAIT_PID, 1, 2, false, true}, {ACTION_WAIT_FS, 1, 2, false, true}, {ACTION_CONNECT, 2, 2, false, true}, {ACTION_APP, 1, 1, false, true}, {ACTION_SIGNAL, 1, 2, false, false}, {ACTION_ENV, 2, 2, false, true}, {ACTION_ENV_SET, 2, 2, false, false}, {ACTION_USER_EXIST, 1, 1, false, true}, {ACTION_USER_ID, 2, 2, false, true}, {ACTION_USER_GID, 2, 2, false, true}, {ACTION_USER_GROUP, 2, 2, false, true}, {ACTION_USER_SHELL, 2, 2, false, true}, {ACTION_USER_HOME, 2, 2, false, true}, {ACTION_GROUP_EXIST, 1, 1, false, true}, {ACTION_GROUP_ID, 2, 2, false, true}, {ACTION_SERVICE_PRESENT, 1, 1, false, true}, {ACTION_SERVICE_ENABLED, 1, 1, false, true}, {ACTION_SERVICE_WORKS, 1, 1, false, true}, {ACTION_HTTP_STATUS, 3, 4, false, true}, {ACTION_HTTP_HEADER, 4, 5, false, true}, {ACTION_HTTP_CONTAINS, 3, 4, false, true}, {ACTION_HTTP_JSON, 4, 4, false, true}, {ACTION_HTTP_SET_AUTH, 2, 2, false, false}, {ACTION_HTTP_SET_HEADER, 2, 2, false, false}, {ACTION_LIB_LOADED, 1, 1, false, true}, {ACTION_LIB_HEADER, 1, 1, false, true}, {ACTION_LIB_CONFIG, 1, 1, false, true}, {ACTION_LIB_EXIST, 1, 1, false, true}, {ACTION_LIB_LINKED, 2, 2, false, true}, {ACTION_PYTHON_MODULE, 1, 1, false, false}, {ACTION_PYTHON3_MODULE, 1, 1, false, false}, }
Tokens is slice with tokens info
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Name string // Name Arguments []string // Arguments Negative bool // Is negative Line uint16 // Line in recipe Command *Command // Link to command }
Action contains action name and slice with arguments
type Command ¶
type Command struct { User string // User name Tag string // Tag Cmdline string // Command line Description string // Description Actions []*Action // Slice with actions Line uint16 // Line in recipe Recipe *Recipe // Link to recipe // contains filtered or unexported fields }
Command contains command with all actions
func NewCommand ¶
NewCommand create new command struct
func (*Command) GetCmdline ¶
GetCmdline returns command line with rendered variables
func (*Command) GetCmdlineArgs ¶
GetCmdlineArgs returns command line arguments, including the command as [0]
type Recipe ¶
type Recipe struct { File string // Path to recipe Dir string // Working dir UnsafeActions bool // Allow unsafe actions RequireRoot bool // Require root privileges FastFinish bool // Fast finish flag LockWorkdir bool // Locking workdir flag Delay float64 // Delay between commands Packages []string // Package list Commands []*Command // Commands // contains filtered or unexported fields }
Recipe contains recipe data
func (*Recipe) AddCommand ¶
AddCommand appends command to command slice
func (*Recipe) AddVariable ¶
AddVariable adds new RO variable
func (*Recipe) GetPackages ¶
GetPackages flatten packages slice to string
func (*Recipe) GetVariable ¶
GetVariable returns variable value as string
func (*Recipe) SetVariable ¶
SetVariable sets RW variable
Click to show internal directories.
Click to hide internal directories.