Documentation
¶
Index ¶
- func FilterPlanError(err error, command string) error
- func GetExitCode(err error) (int, error)
- func LookPath(command string, paths ...string) (string, error)
- func PromptUserForYesNo(prompt string, terragruntOptions *options.TerragruntOptions) (bool, error)
- func RunCommandToApprove(cmd *exec.Cmd, expectedStatements []string, completedStatements []string, ...) error
- type CommandContext
- func (c *CommandContext) Args(args ...string) *CommandContext
- func (c *CommandContext) Env(values ...string) *CommandContext
- func (c *CommandContext) ExpandArgs() *CommandContext
- func (c *CommandContext) Expect(expected []string, completed []string) *CommandContext
- func (c CommandContext) LogOutput(logLevel logrus.Level) error
- func (c CommandContext) Output() (string, error)
- func (c CommandContext) Run() error
- func (c *CommandContext) WithRetries(retries int) *CommandContext
- func (c *CommandContext) WorkingDir(wd string) *CommandContext
- type OutputInterceptor
- type SignalsForwarder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterPlanError ¶
FilterPlanError filters to trap plan exit code that are not real error
func GetExitCode ¶
GetExitCode returns the exit code of a command. If the error does not implement errors.IErrorCode or is not an exec.ExitError type, the error is returned.
func LookPath ¶
LookPath search the supplied path to find the desired command It uses a mutex since it has to temporary override the global PATH variable.
func PromptUserForYesNo ¶
func PromptUserForYesNo(prompt string, terragruntOptions *options.TerragruntOptions) (bool, error)
PromptUserForYesNo prompts the user for a yes/no response and return true if they entered yes.
func RunCommandToApprove ¶
func RunCommandToApprove(cmd *exec.Cmd, expectedStatements []string, completedStatements []string, terragruntOptions *options.TerragruntOptions) error
RunCommandToApprove runs a command with approval (expect style)
Types ¶
type CommandContext ¶
type CommandContext struct {
Stdout, Stderr io.Writer // If these variables are left unset, the default value from current options set will be used
DisplayCommand string // If not specified, the actual command will be displayed
// contains filtered or unexported fields
}
CommandContext is the description of the command that must be executed
func NewCmd ¶
func NewCmd(options *options.TerragruntOptions, cmd string) *CommandContext
NewCmd initializes the ShellCommand object
func NewTFCmd ¶
func NewTFCmd(options *options.TerragruntOptions) *CommandContext
NewTFCmd initializes the ShellCommand object with terraform as the command
func (*CommandContext) Args ¶
func (c *CommandContext) Args(args ...string) *CommandContext
Args add arguments to the CommandContext
func (*CommandContext) Env ¶
func (c *CommandContext) Env(values ...string) *CommandContext
Env set additional environment variables in the CommandContext
func (*CommandContext) ExpandArgs ¶
func (c *CommandContext) ExpandArgs() *CommandContext
ExpandArgs instructs that arguments should be expanded before run
func (*CommandContext) Expect ¶
func (c *CommandContext) Expect(expected []string, completed []string) *CommandContext
Expect instructs that a special behavior should be done on some outputs
func (CommandContext) LogOutput ¶
func (c CommandContext) LogOutput(logLevel logrus.Level) error
LogOutput runs the current command and log the output (stdout and stderr)
func (CommandContext) Output ¶
func (c CommandContext) Output() (string, error)
Output runs the current command and returns the output (stdout and stderr)
func (*CommandContext) WithRetries ¶
func (c *CommandContext) WithRetries(retries int) *CommandContext
WithRetries adds a number retries to commands before failing
func (*CommandContext) WorkingDir ¶
func (c *CommandContext) WorkingDir(wd string) *CommandContext
WorkingDir changes the default working directory for the command
type OutputInterceptor ¶
type OutputInterceptor struct {
// contains filtered or unexported fields
}
OutputInterceptor intercepts all writes to a io.Writer and writes them to a buffer while still letting them pass through. Offers some functions to help the approval process.
func (*OutputInterceptor) GetBuffer ¶
func (interceptor *OutputInterceptor) GetBuffer() string
GetBuffer returns the string value of all intercepted data to the underlying writer.
func (*OutputInterceptor) IsComplete ¶
func (interceptor *OutputInterceptor) IsComplete() bool
IsComplete returns true if the command is complete and should exit.
func (*OutputInterceptor) WaitingForValue ¶
func (interceptor *OutputInterceptor) WaitingForValue() bool
WaitingForValue returns true if the command is waiting for an input value based on its output.
type SignalsForwarder ¶
SignalsForwarder forwards signals to a command, waiting for the command to finish.
func NewSignalsForwarder ¶
func NewSignalsForwarder(signals []os.Signal, c *exec.Cmd, logger *multilogger.Logger, cmdChannel chan error) SignalsForwarder
NewSignalsForwarder returns a new SignalsForwarder
func (*SignalsForwarder) Close ¶
func (signalChannel *SignalsForwarder) Close() error
Close closes the signal channel