Documentation ¶
Index ¶
- Constants
- Variables
- func AllCurrentAzureChains(exec utilexec.Interface, lockWaitTimeSeconds string) (map[string]struct{}, error)
- func DoublePipeToGrep(command, grepCommand1, grepCommand2 utilexec.Cmd) (searchResults []byte, gotMatches bool, commandError error)
- func PipeCommandToGrep(command, grepCommand utilexec.Cmd) (searchResults []byte, gotMatches bool, commandError error)
- type ErrorDefinition
- type FileCreator
- func (creator *FileCreator) AddErrorToRetryOn(definition *ErrorDefinition)
- func (creator *FileCreator) AddLine(sectionID string, errorHandlers []*LineErrorHandler, items ...string)
- func (creator *FileCreator) RunCommandOnceWithFile(cmd string, args ...string) (bool, error)
- func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error
- func (creator *FileCreator) ToString() string
- func (creator *FileCreator) Verbose()
- type Line
- type LineErrorHandler
- type LineErrorHandlerMethod
- type Section
Constants ¶
const ( Grep = "grep" GrepRegexFlag = "-P" GrepOnlyMatchingFlag = "-o" GrepAntiMatchFlag = "-v" GrepQuietFlag = "-q" GrepBeforeFlag = "-B" )
Grep is the grep command string
Variables ¶
var AlwaysMatchDefinition = NewErrorDefinition(anyMatchPattern)
AlwaysMatchDefinition will match any error
Functions ¶
func AllCurrentAzureChains ¶
func DoublePipeToGrep ¶
Types ¶
type ErrorDefinition ¶
type ErrorDefinition struct {
// contains filtered or unexported fields
}
ErrorDefinition defines an error by a regular expression and its error code.
func NewErrorDefinition ¶
func NewErrorDefinition(pattern string) *ErrorDefinition
type FileCreator ¶
type FileCreator struct {
// contains filtered or unexported fields
}
FileCreator is a tool for: - building a buffer file - running a command with the file - handling errors in the file
func NewFileCreator ¶
func NewFileCreator(ioShim *common.IOShim, maxTryCount int, lineFailurePatterns ...string) *FileCreator
func (*FileCreator) AddErrorToRetryOn ¶
func (creator *FileCreator) AddErrorToRetryOn(definition *ErrorDefinition)
func (*FileCreator) AddLine ¶
func (creator *FileCreator) AddLine(sectionID string, errorHandlers []*LineErrorHandler, items ...string)
func (*FileCreator) RunCommandOnceWithFile ¶
func (creator *FileCreator) RunCommandOnceWithFile(cmd string, args ...string) (bool, error)
RunCommandOnceWithFile runs the command with the file once and increments the try count. It returns whether the file was altered and any error. For automatic retrying and proper logging, use RunCommandWithFile. This method can be used for external testing of file creator contents after each run.
func (*FileCreator) RunCommandWithFile ¶
func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error
func (*FileCreator) ToString ¶
func (creator *FileCreator) ToString() string
ToString combines the lines in the FileCreator and ends with a new line.
func (*FileCreator) Verbose ¶
func (creator *FileCreator) Verbose()
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line defines the content, section, and error handlers for a line
type LineErrorHandler ¶
type LineErrorHandler struct { Definition *ErrorDefinition Method LineErrorHandlerMethod Callback func() }
LineErrorHandler defines an error and how to handle it
type LineErrorHandlerMethod ¶
type LineErrorHandlerMethod string
LineErrorHandlerMethod defines behavior when an error occurs
const ( // Continue specifies skipping this line and all previous lines Continue LineErrorHandlerMethod = "continue" // ContinueAndAbortSection specifies skipping this line, all previous lines, and all lines tied to this line's section ContinueAndAbortSection LineErrorHandlerMethod = "continue-and-abort" )