shell_local

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToLinuxPath

func ConvertToLinuxPath(winAbsPath string) (string, error)

C:/path/to/your/file becomes /mnt/c/path/to/your/file

func Decode

func Decode(config *Config, raws ...interface{}) error

func Run

func Run(ctx context.Context, ui packersdk.Ui, config *Config, generatedData map[string]interface{}) (bool, error)

func Validate

func Validate(config *Config) error

Types

type Communicator

type Communicator struct {
	ExecuteCommand []string
}

func (*Communicator) Download

func (c *Communicator) Download(string, io.Writer) error

func (*Communicator) DownloadDir

func (c *Communicator) DownloadDir(string, string, []string) error

func (*Communicator) Start

func (c *Communicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error

func (*Communicator) Upload

func (c *Communicator) Upload(string, io.Reader, *os.FileInfo) error

func (*Communicator) UploadDir

func (c *Communicator) UploadDir(string, string, []string) error

type Config

type Config struct {
	shell.Provisioner `mapstructure:",squash"`

	// ** DEPRECATED: USE INLINE INSTEAD **
	// ** Only Present for backwards compatibility **
	// Command is the command to execute
	Command string

	// The command used to execute the script. The '{{ .Path }}' variable
	// should be used to specify where the script goes, {{ .Vars }}
	// can be used to inject the environment_vars into the environment.
	ExecuteCommand []string `mapstructure:"execute_command"`

	// The shebang value used when running inline scripts.
	InlineShebang string `mapstructure:"inline_shebang"`

	// An array of multiple Runtime OSs to run on.
	OnlyOn []string `mapstructure:"only_on"`

	// The file extension to use for the file generated from the inline commands
	TempfileExtension string `mapstructure:"tempfile_extension"`

	// End dedupe with postprocessor
	UseLinuxPathing bool `mapstructure:"use_linux_pathing"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	PackerBuildName     *string           `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
	PackerBuilderType   *string           `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
	PackerCoreVersion   *string           `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"`
	PackerDebug         *bool             `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
	PackerForce         *bool             `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
	PackerOnError       *string           `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
	PackerUserVars      map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
	PackerSensitiveVars []string          `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
	Inline              []string          `cty:"inline" hcl:"inline"`
	Script              *string           `cty:"script" hcl:"script"`
	Scripts             []string          `cty:"scripts" hcl:"scripts"`
	ValidExitCodes      []int             `mapstructure:"valid_exit_codes" cty:"valid_exit_codes" hcl:"valid_exit_codes"`
	Vars                []string          `mapstructure:"environment_vars" cty:"environment_vars" hcl:"environment_vars"`
	Env                 map[string]string `mapstructure:"env" cty:"env" hcl:"env"`
	EnvVarFormat        *string           `mapstructure:"env_var_format" cty:"env_var_format" hcl:"env_var_format"`
	Command             *string           `cty:"command" hcl:"command"`
	ExecuteCommand      []string          `mapstructure:"execute_command" cty:"execute_command" hcl:"execute_command"`
	InlineShebang       *string           `mapstructure:"inline_shebang" cty:"inline_shebang" hcl:"inline_shebang"`
	OnlyOn              []string          `mapstructure:"only_on" cty:"only_on" hcl:"only_on"`
	TempfileExtension   *string           `mapstructure:"tempfile_extension" cty:"tempfile_extension" hcl:"tempfile_extension"`
	UseLinuxPathing     *bool             `mapstructure:"use_linux_pathing" cty:"use_linux_pathing" hcl:"use_linux_pathing"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL