communicator

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const TestPEMContents = `` /* 1680-byte string literal not displayed */

Variables

This section is empty.

Functions

func TestPEM

func TestPEM(t *testing.T) string

Types

type Config

type Config struct {
	Type string `mapstructure:"communicator"`

	// SSH
	SSHHost                   string        `mapstructure:"ssh_host"`
	SSHPort                   int           `mapstructure:"ssh_port"`
	SSHUsername               string        `mapstructure:"ssh_username"`
	SSHPassword               string        `mapstructure:"ssh_password"`
	SSHPublicKey              []byte        `mapstructure:"ssh_public_key"`
	SSHPrivateKey             []byte        `mapstructure:"ssh_private_key"`
	SSHKeyPairName            string        `mapstructure:"ssh_keypair_name"`
	SSHTemporaryKeyPairName   string        `mapstructure:"temporary_key_pair_name"`
	SSHPrivateKeyFile         string        `mapstructure:"ssh_private_key_file"`
	SSHInterface              string        `mapstructure:"ssh_interface"`
	SSHIPVersion              string        `mapstructure:"ssh_ip_version"`
	SSHPty                    bool          `mapstructure:"ssh_pty"`
	SSHTimeout                time.Duration `mapstructure:"ssh_timeout"`
	SSHAgentAuth              bool          `mapstructure:"ssh_agent_auth"`
	SSHDisableAgentForwarding bool          `mapstructure:"ssh_disable_agent_forwarding"`
	SSHHandshakeAttempts      int           `mapstructure:"ssh_handshake_attempts"`
	SSHBastionHost            string        `mapstructure:"ssh_bastion_host"`
	SSHBastionPort            int           `mapstructure:"ssh_bastion_port"`
	SSHBastionAgentAuth       bool          `mapstructure:"ssh_bastion_agent_auth"`
	SSHBastionUsername        string        `mapstructure:"ssh_bastion_username"`
	SSHBastionPassword        string        `mapstructure:"ssh_bastion_password"`
	SSHBastionPrivateKeyFile  string        `mapstructure:"ssh_bastion_private_key_file"`
	SSHFileTransferMethod     string        `mapstructure:"ssh_file_transfer_method"`
	SSHProxyHost              string        `mapstructure:"ssh_proxy_host"`
	SSHProxyPort              int           `mapstructure:"ssh_proxy_port"`
	SSHProxyUsername          string        `mapstructure:"ssh_proxy_username"`
	SSHProxyPassword          string        `mapstructure:"ssh_proxy_password"`
	SSHKeepAliveInterval      time.Duration `mapstructure:"ssh_keep_alive_interval"`
	SSHReadWriteTimeout       time.Duration `mapstructure:"ssh_read_write_timeout"`

	// WinRM
	WinRMUser               string        `mapstructure:"winrm_username"`
	WinRMPassword           string        `mapstructure:"winrm_password"`
	WinRMHost               string        `mapstructure:"winrm_host"`
	WinRMPort               int           `mapstructure:"winrm_port"`
	WinRMTimeout            time.Duration `mapstructure:"winrm_timeout"`
	WinRMUseSSL             bool          `mapstructure:"winrm_use_ssl"`
	WinRMInsecure           bool          `mapstructure:"winrm_insecure"`
	WinRMUseNTLM            bool          `mapstructure:"winrm_use_ntlm"`
	WinRMTransportDecorator func() winrm.Transporter
}

Config is the common configuration that communicators allow within a builder.

func (*Config) Host added in v0.11.0

func (c *Config) Host() string

Host returns the port that will be used for access based on config.

func (*Config) Password added in v0.11.0

func (c *Config) Password() string

Password returns the port that will be used for access based on config.

func (*Config) Port

func (c *Config) Port() int

Port returns the port that will be used for access based on config.

func (*Config) Prepare

func (c *Config) Prepare(ctx *interpolate.Context) []error

func (*Config) SSHConfigFunc added in v1.3.0

func (c *Config) SSHConfigFunc() func(multistep.StateBag) (*ssh.ClientConfig, error)

SSHConfigFunc returns a function that can be used for the SSH communicator config for connecting to the instance created over SSH using the private key or password.

func (*Config) User added in v0.11.0

func (c *Config) User() string

User returns the port that will be used for access based on config.

type StepConnect

type StepConnect struct {
	// Config is the communicator config struct
	Config *Config

	// Host should return a host that can be connected to for communicator
	// connections.
	Host func(multistep.StateBag) (string, error)

	// The fields below are callbacks to assist with connecting to SSH.
	//
	// SSHConfig should return the default configuration for
	// connecting via SSH.
	SSHConfig func(multistep.StateBag) (*gossh.ClientConfig, error)
	SSHPort   func(multistep.StateBag) (int, error)

	// The fields below are callbacks to assist with connecting to WinRM.
	//
	// WinRMConfig should return the default configuration for
	// connecting via WinRM.
	WinRMConfig func(multistep.StateBag) (*WinRMConfig, error)
	WinRMPort   func(multistep.StateBag) (int, error)

	// CustomConnect can be set to have custom connectors for specific
	// types. These take highest precedence so you can also override
	// existing types.
	CustomConnect map[string]multistep.Step
	// contains filtered or unexported fields
}

StepConnect is a multistep Step implementation that connects to the proper communicator and stores it in the "communicator" key in the state bag.

func (*StepConnect) Cleanup

func (s *StepConnect) Cleanup(state multistep.StateBag)

func (*StepConnect) Run

type StepConnectSSH

type StepConnectSSH struct {
	// All the fields below are documented on StepConnect
	Config    *Config
	Host      func(multistep.StateBag) (string, error)
	SSHConfig func(multistep.StateBag) (*gossh.ClientConfig, error)
	SSHPort   func(multistep.StateBag) (int, error)
}

StepConnectSSH is a step that only connects to SSH.

In general, you should use StepConnect.

func (*StepConnectSSH) Cleanup

func (s *StepConnectSSH) Cleanup(multistep.StateBag)

func (*StepConnectSSH) Run

type StepConnectWinRM

type StepConnectWinRM struct {
	// All the fields below are documented on StepConnect
	Config      *Config
	Host        func(multistep.StateBag) (string, error)
	WinRMConfig func(multistep.StateBag) (*WinRMConfig, error)
	WinRMPort   func(multistep.StateBag) (int, error)
}

StepConnectWinRM is a multistep Step implementation that waits for WinRM to become available. It gets the connection information from a single configuration when creating the step.

Uses:

ui packer.Ui

Produces:

communicator packer.Communicator

func (*StepConnectWinRM) Cleanup

func (s *StepConnectWinRM) Cleanup(multistep.StateBag)

func (*StepConnectWinRM) Run

type WinRMConfig

type WinRMConfig struct {
	Username string
	Password string
}

WinRMConfig is configuration that can be returned at runtime to dynamically configure WinRM.

Jump to

Keyboard shortcuts

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