id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
165,000
hashicorp/packer
builder/hyperv/common/driver_ps_4.go
GetVirtualMachineNetworkAdapterAddress
func (d *HypervPS4Driver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error) { return hyperv.GetVirtualMachineNetworkAdapterAddress(vmName) }
go
func (d *HypervPS4Driver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error) { return hyperv.GetVirtualMachineNetworkAdapterAddress(vmName) }
[ "func", "(", "d", "*", "HypervPS4Driver", ")", "GetVirtualMachineNetworkAdapterAddress", "(", "vmName", "string", ")", "(", "string", ",", "error", ")", "{", "return", "hyperv", ".", "GetVirtualMachineNetworkAdapterAddress", "(", "vmName", ")", "\n", "}" ]
// Get network adapter address
[ "Get", "network", "adapter", "address" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/driver_ps_4.go#L136-L138
165,001
hashicorp/packer
builder/hyperv/common/driver_ps_4.go
SetNetworkAdapterVlanId
func (d *HypervPS4Driver) SetNetworkAdapterVlanId(switchName string, vlanId string) error { return hyperv.SetNetworkAdapterVlanId(switchName, vlanId) }
go
func (d *HypervPS4Driver) SetNetworkAdapterVlanId(switchName string, vlanId string) error { return hyperv.SetNetworkAdapterVlanId(switchName, vlanId) }
[ "func", "(", "d", "*", "HypervPS4Driver", ")", "SetNetworkAdapterVlanId", "(", "switchName", "string", ",", "vlanId", "string", ")", "error", "{", "return", "hyperv", ".", "SetNetworkAdapterVlanId", "(", "switchName", ",", "vlanId", ")", "\n", "}" ]
//Set the vlan to use for switch
[ "Set", "the", "vlan", "to", "use", "for", "switch" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/driver_ps_4.go#L141-L143
165,002
hashicorp/packer
builder/hyperv/common/driver_ps_4.go
SetVirtualMachineVlanId
func (d *HypervPS4Driver) SetVirtualMachineVlanId(vmName string, vlanId string) error { return hyperv.SetVirtualMachineVlanId(vmName, vlanId) }
go
func (d *HypervPS4Driver) SetVirtualMachineVlanId(vmName string, vlanId string) error { return hyperv.SetVirtualMachineVlanId(vmName, vlanId) }
[ "func", "(", "d", "*", "HypervPS4Driver", ")", "SetVirtualMachineVlanId", "(", "vmName", "string", ",", "vlanId", "string", ")", "error", "{", "return", "hyperv", ".", "SetVirtualMachineVlanId", "(", "vmName", ",", "vlanId", ")", "\n", "}" ]
//Set the vlan to use for machine
[ "Set", "the", "vlan", "to", "use", "for", "machine" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/driver_ps_4.go#L146-L148
165,003
hashicorp/packer
builder/hyperv/common/driver_ps_4.go
Connect
func (d *HypervPS4Driver) Connect(vmName string) (context.CancelFunc, error) { return hyperv.ConnectVirtualMachine(vmName) }
go
func (d *HypervPS4Driver) Connect(vmName string) (context.CancelFunc, error) { return hyperv.ConnectVirtualMachine(vmName) }
[ "func", "(", "d", "*", "HypervPS4Driver", ")", "Connect", "(", "vmName", "string", ")", "(", "context", ".", "CancelFunc", ",", "error", ")", "{", "return", "hyperv", ".", "ConnectVirtualMachine", "(", "vmName", ")", "\n", "}" ]
// Connect connects to a VM specified by the name given.
[ "Connect", "connects", "to", "a", "VM", "specified", "by", "the", "name", "given", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/driver_ps_4.go#L373-L375
165,004
hashicorp/packer
common/multistep_runner.go
NewRunner
func NewRunner(steps []multistep.Step, config PackerConfig, ui packer.Ui) multistep.Runner { runner, _ := newRunner(steps, config, ui) return runner }
go
func NewRunner(steps []multistep.Step, config PackerConfig, ui packer.Ui) multistep.Runner { runner, _ := newRunner(steps, config, ui) return runner }
[ "func", "NewRunner", "(", "steps", "[", "]", "multistep", ".", "Step", ",", "config", "PackerConfig", ",", "ui", "packer", ".", "Ui", ")", "multistep", ".", "Runner", "{", "runner", ",", "_", ":=", "newRunner", "(", "steps", ",", "config", ",", "ui", ...
// NewRunner returns a multistep.Runner that runs steps augmented with support // for -debug and -on-error command line arguments.
[ "NewRunner", "returns", "a", "multistep", ".", "Runner", "that", "runs", "steps", "augmented", "with", "support", "for", "-", "debug", "and", "-", "on", "-", "error", "command", "line", "arguments", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/multistep_runner.go#L39-L42
165,005
hashicorp/packer
common/multistep_runner.go
NewRunnerWithPauseFn
func NewRunnerWithPauseFn(steps []multistep.Step, config PackerConfig, ui packer.Ui, state multistep.StateBag) multistep.Runner { runner, pauseFn := newRunner(steps, config, ui) if pauseFn != nil { state.Put("pauseFn", pauseFn) } return runner }
go
func NewRunnerWithPauseFn(steps []multistep.Step, config PackerConfig, ui packer.Ui, state multistep.StateBag) multistep.Runner { runner, pauseFn := newRunner(steps, config, ui) if pauseFn != nil { state.Put("pauseFn", pauseFn) } return runner }
[ "func", "NewRunnerWithPauseFn", "(", "steps", "[", "]", "multistep", ".", "Step", ",", "config", "PackerConfig", ",", "ui", "packer", ".", "Ui", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "Runner", "{", "runner", ",", "pauseFn", ":=...
// NewRunnerWithPauseFn returns a multistep.Runner that runs steps augmented // with support for -debug and -on-error command line arguments. With -debug it // puts the multistep.DebugPauseFn that will pause execution between steps into // the state under the key "pauseFn".
[ "NewRunnerWithPauseFn", "returns", "a", "multistep", ".", "Runner", "that", "runs", "steps", "augmented", "with", "support", "for", "-", "debug", "and", "-", "on", "-", "error", "command", "line", "arguments", ".", "With", "-", "debug", "it", "puts", "the", ...
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/multistep_runner.go#L48-L54
165,006
hashicorp/packer
builder/amazon/common/errors.go
decodeAWSError
func decodeAWSError(decoder stsDecoder, err error) error { groups := encodedFailureMessagePattern.FindStringSubmatch(err.Error()) if groups != nil && len(groups) > 1 { result, decodeErr := decoder.DecodeAuthorizationMessage(&sts.DecodeAuthorizationMessageInput{ EncodedMessage: aws.String(groups[2]), }) if d...
go
func decodeAWSError(decoder stsDecoder, err error) error { groups := encodedFailureMessagePattern.FindStringSubmatch(err.Error()) if groups != nil && len(groups) > 1 { result, decodeErr := decoder.DecodeAuthorizationMessage(&sts.DecodeAuthorizationMessageInput{ EncodedMessage: aws.String(groups[2]), }) if d...
[ "func", "decodeAWSError", "(", "decoder", "stsDecoder", ",", "err", "error", ")", "error", "{", "groups", ":=", "encodedFailureMessagePattern", ".", "FindStringSubmatch", "(", "err", ".", "Error", "(", ")", ")", "\n", "if", "groups", "!=", "nil", "&&", "len"...
// decodeError replaces encoded authorization messages with the // decoded results
[ "decodeError", "replaces", "encoded", "authorization", "messages", "with", "the", "decoded", "results" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/errors.go#L24-L38
165,007
hashicorp/packer
builder/amazon/common/errors.go
DecodeAuthZMessages
func DecodeAuthZMessages(sess *session.Session) { azd := &authZMessageDecoder{ Decoder: sts.New(sess), } sess.Handlers.UnmarshalError.AfterEachFn = azd.afterEachFn }
go
func DecodeAuthZMessages(sess *session.Session) { azd := &authZMessageDecoder{ Decoder: sts.New(sess), } sess.Handlers.UnmarshalError.AfterEachFn = azd.afterEachFn }
[ "func", "DecodeAuthZMessages", "(", "sess", "*", "session", ".", "Session", ")", "{", "azd", ":=", "&", "authZMessageDecoder", "{", "Decoder", ":", "sts", ".", "New", "(", "sess", ")", ",", "}", "\n", "sess", ".", "Handlers", ".", "UnmarshalError", ".", ...
// DecodeAuthZMessages enables automatic decoding of any // encoded authorization messages
[ "DecodeAuthZMessages", "enables", "automatic", "decoding", "of", "any", "encoded", "authorization", "messages" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/errors.go#L42-L47
165,008
hashicorp/packer
builder/triton/access_config.go
Prepare
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { var errs []error if c.Endpoint == "" { // Use Joyent public cloud as the default endpoint if none is specified c.Endpoint = "https://us-sw-1.api.joyent.com" } if c.Account == "" { errs = append(errs, errors.New("triton_account is required to...
go
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { var errs []error if c.Endpoint == "" { // Use Joyent public cloud as the default endpoint if none is specified c.Endpoint = "https://us-sw-1.api.joyent.com" } if c.Account == "" { errs = append(errs, errors.New("triton_account is required to...
[ "func", "(", "c", "*", "AccessConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ")", "[", "]", "error", "{", "var", "errs", "[", "]", "error", "\n\n", "if", "c", ".", "Endpoint", "==", "\"", "\"", "{", "// Use Joyent public cloud...
// Prepare performs basic validation on the AccessConfig and ensures we can sign // a request.
[ "Prepare", "performs", "basic", "validation", "on", "the", "AccessConfig", "and", "ensures", "we", "can", "sign", "a", "request", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/triton/access_config.go#L32-L67
165,009
hashicorp/packer
builder/cloudstack/artifact.go
Destroy
func (a *Artifact) Destroy() error { // Create a new parameter struct. p := a.client.Template.NewDeleteTemplateParams(a.template.Id) // Destroy the template. log.Printf("Destroying template: %s", a.template.Name) _, err := a.client.Template.DeleteTemplate(p) if err != nil { // This is a very poor way to be tol...
go
func (a *Artifact) Destroy() error { // Create a new parameter struct. p := a.client.Template.NewDeleteTemplateParams(a.template.Id) // Destroy the template. log.Printf("Destroying template: %s", a.template.Name) _, err := a.client.Template.DeleteTemplate(p) if err != nil { // This is a very poor way to be tol...
[ "func", "(", "a", "*", "Artifact", ")", "Destroy", "(", ")", "error", "{", "// Create a new parameter struct.", "p", ":=", "a", ".", "client", ".", "Template", ".", "NewDeleteTemplateParams", "(", "a", ".", "template", ".", "Id", ")", "\n\n", "// Destroy the...
// Destroy the CloudStack template represented by the artifact.
[ "Destroy", "the", "CloudStack", "template", "represented", "by", "the", "artifact", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/cloudstack/artifact.go#L24-L43
165,010
hashicorp/packer
builder/googlecompute/step_instance_info.go
Run
func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) instanceName := state.Get("instance_name").(string) ui.Say("Waiting for the instance to become runn...
go
func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) instanceName := state.Get("instance_name").(string) ui.Say("Waiting for the instance to become runn...
[ "func", "(", "s", "*", "StepInstanceInfo", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "config", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(", "...
// Run executes the Packer build step that gathers GCE instance info. // This adds "instance_ip" to the multistep state.
[ "Run", "executes", "the", "Packer", "build", "step", "that", "gathers", "GCE", "instance", "info", ".", "This", "adds", "instance_ip", "to", "the", "multistep", "state", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/googlecompute/step_instance_info.go#L20-L78
165,011
hashicorp/packer
builder/googlecompute/step_wait_startup_script.go
Run
func (s *StepWaitStartupScript) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) instanceName := state.Get("instance_name").(string) ui.Say("Waiting for any running startup scr...
go
func (s *StepWaitStartupScript) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) instanceName := state.Get("instance_name").(string) ui.Say("Waiting for any running startup scr...
[ "func", "(", "s", "*", "StepWaitStartupScript", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "config", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "("...
// Run reads the instance metadata and looks for the log entry // indicating the startup script finished.
[ "Run", "reads", "the", "instance", "metadata", "and", "looks", "for", "the", "log", "entry", "indicating", "the", "startup", "script", "finished", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/googlecompute/step_wait_startup_script.go#L18-L63
165,012
hashicorp/packer
common/shell-local/run.go
createInterpolatedCommands
func createInterpolatedCommands(config *Config, script string, flattenedEnvVars string) ([]string, error) { config.Ctx.Data = &ExecuteCommandTemplate{ Vars: flattenedEnvVars, Script: script, Command: script, WinRMPassword: getWinRMPassword(config.PackerBuildName), } interpolatedCmds :=...
go
func createInterpolatedCommands(config *Config, script string, flattenedEnvVars string) ([]string, error) { config.Ctx.Data = &ExecuteCommandTemplate{ Vars: flattenedEnvVars, Script: script, Command: script, WinRMPassword: getWinRMPassword(config.PackerBuildName), } interpolatedCmds :=...
[ "func", "createInterpolatedCommands", "(", "config", "*", "Config", ",", "script", "string", ",", "flattenedEnvVars", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "config", ".", "Ctx", ".", "Data", "=", "&", "ExecuteCommandTemplate", "{", ...
// Generates the final command to send to the communicator, using either the // user-provided ExecuteCommand or defaulting to something that makes sense for // the host OS
[ "Generates", "the", "final", "command", "to", "send", "to", "the", "communicator", "using", "either", "the", "user", "-", "provided", "ExecuteCommand", "or", "defaulting", "to", "something", "that", "makes", "sense", "for", "the", "host", "OS" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/shell-local/run.go#L157-L174
165,013
hashicorp/packer
builder/vagrant/driver_2_2.go
Init
func (d *Vagrant_2_2_Driver) Init(args []string) error { _, _, err := d.vagrantCmd(append([]string{"init"}, args...)...) return err }
go
func (d *Vagrant_2_2_Driver) Init(args []string) error { _, _, err := d.vagrantCmd(append([]string{"init"}, args...)...) return err }
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Init", "(", "args", "[", "]", "string", ")", "error", "{", "_", ",", "_", ",", "err", ":=", "d", ".", "vagrantCmd", "(", "append", "(", "[", "]", "string", "{", "\"", "\"", "}", ",", "args", "....
// Calls "vagrant init"
[ "Calls", "vagrant", "init" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L24-L27
165,014
hashicorp/packer
builder/vagrant/driver_2_2.go
Up
func (d *Vagrant_2_2_Driver) Up(args []string) (string, string, error) { stdout, stderr, err := d.vagrantCmd(append([]string{"up"}, args...)...) return stdout, stderr, err }
go
func (d *Vagrant_2_2_Driver) Up(args []string) (string, string, error) { stdout, stderr, err := d.vagrantCmd(append([]string{"up"}, args...)...) return stdout, stderr, err }
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Up", "(", "args", "[", "]", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "stdout", ",", "stderr", ",", "err", ":=", "d", ".", "vagrantCmd", "(", "append", "(", "[", "]", "...
// Calls "vagrant up"
[ "Calls", "vagrant", "up" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L37-L40
165,015
hashicorp/packer
builder/vagrant/driver_2_2.go
Halt
func (d *Vagrant_2_2_Driver) Halt(id string) error { args := []string{"halt"} if id != "" { args = append(args, id) } _, _, err := d.vagrantCmd(args...) return err }
go
func (d *Vagrant_2_2_Driver) Halt(id string) error { args := []string{"halt"} if id != "" { args = append(args, id) } _, _, err := d.vagrantCmd(args...) return err }
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Halt", "(", "id", "string", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "if", "id", "!=", "\"", "\"", "{", "args", "=", "append", "(", "args", ",", "id", ")...
// Calls "vagrant halt"
[ "Calls", "vagrant", "halt" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L43-L50
165,016
hashicorp/packer
builder/vagrant/driver_2_2.go
Package
func (d *Vagrant_2_2_Driver) Package(args []string) error { args = append(args, "--output", filepath.Join(d.VagrantCWD, "package.box")) _, _, err := d.vagrantCmd(append([]string{"package"}, args...)...) return err }
go
func (d *Vagrant_2_2_Driver) Package(args []string) error { args = append(args, "--output", filepath.Join(d.VagrantCWD, "package.box")) _, _, err := d.vagrantCmd(append([]string{"package"}, args...)...) return err }
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Package", "(", "args", "[", "]", "string", ")", "error", "{", "args", "=", "append", "(", "args", ",", "\"", "\"", ",", "filepath", ".", "Join", "(", "d", ".", "VagrantCWD", ",", "\"", "\"", ")", ...
// Calls "vagrant package"
[ "Calls", "vagrant", "package" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L73-L77
165,017
hashicorp/packer
builder/vagrant/driver_2_2.go
Verify
func (d *Vagrant_2_2_Driver) Verify() error { vagrantPath, err := exec.LookPath(d.vagrantBinary) if err != nil { return fmt.Errorf("Can't find Vagrant binary!") } _, err = os.Stat(vagrantPath) if err != nil { return fmt.Errorf("Can't find Vagrant binary.") } constraints, err := version.NewConstraint(VAGRANT...
go
func (d *Vagrant_2_2_Driver) Verify() error { vagrantPath, err := exec.LookPath(d.vagrantBinary) if err != nil { return fmt.Errorf("Can't find Vagrant binary!") } _, err = os.Stat(vagrantPath) if err != nil { return fmt.Errorf("Can't find Vagrant binary.") } constraints, err := version.NewConstraint(VAGRANT...
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Verify", "(", ")", "error", "{", "vagrantPath", ",", "err", ":=", "exec", ".", "LookPath", "(", "d", ".", "vagrantBinary", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(...
// Verify makes sure that Vagrant exists at the given path
[ "Verify", "makes", "sure", "that", "Vagrant", "exists", "at", "the", "given", "path" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L80-L102
165,018
hashicorp/packer
builder/vagrant/driver_2_2.go
Version
func (d *Vagrant_2_2_Driver) Version() (string, error) { stdoutString, _, err := d.vagrantCmd([]string{"--version"}...) // Example stdout: // Installed Version: 2.2.3 // // Vagrant was unable to check for the latest version of Vagrant. // Please check manually at https://www.vagrantup.com // Use regex to find...
go
func (d *Vagrant_2_2_Driver) Version() (string, error) { stdoutString, _, err := d.vagrantCmd([]string{"--version"}...) // Example stdout: // Installed Version: 2.2.3 // // Vagrant was unable to check for the latest version of Vagrant. // Please check manually at https://www.vagrantup.com // Use regex to find...
[ "func", "(", "d", "*", "Vagrant_2_2_Driver", ")", "Version", "(", ")", "(", "string", ",", "error", ")", "{", "stdoutString", ",", "_", ",", "err", ":=", "d", ".", "vagrantCmd", "(", "[", "]", "string", "{", "\"", "\"", "}", "...", ")", "\n", "//...
// Version reads the version of VirtualBox that is installed.
[ "Version", "reads", "the", "version", "of", "VirtualBox", "that", "is", "installed", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vagrant/driver_2_2.go#L159-L176
165,019
hashicorp/packer
builder/digitalocean/wait.go
waitForDropletUnlocked
func waitForDropletUnlocked( client *godo.Client, dropletId int, timeout time.Duration) error { done := make(chan struct{}) defer close(done) result := make(chan error, 1) go func() { attempts := 0 for { attempts += 1 log.Printf("[DEBUG] Checking droplet lock state... (attempt: %d)", attempts) dropl...
go
func waitForDropletUnlocked( client *godo.Client, dropletId int, timeout time.Duration) error { done := make(chan struct{}) defer close(done) result := make(chan error, 1) go func() { attempts := 0 for { attempts += 1 log.Printf("[DEBUG] Checking droplet lock state... (attempt: %d)", attempts) dropl...
[ "func", "waitForDropletUnlocked", "(", "client", "*", "godo", ".", "Client", ",", "dropletId", "int", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "defer", "close", "(", "...
// waitForDropletUnlocked waits for the Droplet to be unlocked to // avoid "pending" errors when making state changes.
[ "waitForDropletUnlocked", "waits", "for", "the", "Droplet", "to", "be", "unlocked", "to", "avoid", "pending", "errors", "when", "making", "state", "changes", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/digitalocean/wait.go#L14-L59
165,020
hashicorp/packer
post-processor/vsphere/post-processor.go
escapeWithSpaces
func escapeWithSpaces(stringToEscape string) string { escapedString := url.QueryEscape(stringToEscape) escapedString = strings.Replace(escapedString, "+", `%20`, -1) return escapedString }
go
func escapeWithSpaces(stringToEscape string) string { escapedString := url.QueryEscape(stringToEscape) escapedString = strings.Replace(escapedString, "+", `%20`, -1) return escapedString }
[ "func", "escapeWithSpaces", "(", "stringToEscape", "string", ")", "string", "{", "escapedString", ":=", "url", ".", "QueryEscape", "(", "stringToEscape", ")", "\n", "escapedString", "=", "strings", ".", "Replace", "(", "escapedString", ",", "\"", "\"", ",", "`...
// Encode everything except for + signs
[ "Encode", "everything", "except", "for", "+", "signs" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/post-processor/vsphere/post-processor.go#L231-L235
165,021
hashicorp/packer
builder/amazon/common/state.go
WaitUntilAMIAvailable
func WaitUntilAMIAvailable(ctx aws.Context, conn *ec2.EC2, imageId string) error { imageInput := ec2.DescribeImagesInput{ ImageIds: []*string{&imageId}, } waitOpts := getWaiterOptions() if len(waitOpts) == 0 { // Bump this default to 30 minutes because the aws default // of ten minutes doesn't work for some ...
go
func WaitUntilAMIAvailable(ctx aws.Context, conn *ec2.EC2, imageId string) error { imageInput := ec2.DescribeImagesInput{ ImageIds: []*string{&imageId}, } waitOpts := getWaiterOptions() if len(waitOpts) == 0 { // Bump this default to 30 minutes because the aws default // of ten minutes doesn't work for some ...
[ "func", "WaitUntilAMIAvailable", "(", "ctx", "aws", ".", "Context", ",", "conn", "*", "ec2", ".", "EC2", ",", "imageId", "string", ")", "error", "{", "imageInput", ":=", "ec2", ".", "DescribeImagesInput", "{", "ImageIds", ":", "[", "]", "*", "string", "{...
// Following are wrapper functions that use Packer's environment-variables to // determing retry logic, then call the AWS SDK's built-in waiters.
[ "Following", "are", "wrapper", "functions", "that", "use", "Packer", "s", "environment", "-", "variables", "to", "determing", "retry", "logic", "then", "call", "the", "AWS", "SDK", "s", "built", "-", "in", "waiters", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/state.go#L39-L55
165,022
hashicorp/packer
builder/amazon/common/state.go
WaitUntilSpotRequestFulfilled
func WaitUntilSpotRequestFulfilled(ctx aws.Context, conn *ec2.EC2, spotRequestId string) error { spotRequestInput := ec2.DescribeSpotInstanceRequestsInput{ SpotInstanceRequestIds: []*string{&spotRequestId}, } err := conn.WaitUntilSpotInstanceRequestFulfilledWithContext( ctx, &spotRequestInput, getWaiterOpti...
go
func WaitUntilSpotRequestFulfilled(ctx aws.Context, conn *ec2.EC2, spotRequestId string) error { spotRequestInput := ec2.DescribeSpotInstanceRequestsInput{ SpotInstanceRequestIds: []*string{&spotRequestId}, } err := conn.WaitUntilSpotInstanceRequestFulfilledWithContext( ctx, &spotRequestInput, getWaiterOpti...
[ "func", "WaitUntilSpotRequestFulfilled", "(", "ctx", "aws", ".", "Context", ",", "conn", "*", "ec2", ".", "EC2", ",", "spotRequestId", "string", ")", "error", "{", "spotRequestInput", ":=", "ec2", ".", "DescribeSpotInstanceRequestsInput", "{", "SpotInstanceRequestId...
// This function works for both requesting and cancelling spot instances.
[ "This", "function", "works", "for", "both", "requesting", "and", "cancelling", "spot", "instances", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/state.go#L71-L81
165,023
hashicorp/packer
builder/amazon/common/state.go
WaitUntilVolumeAttached
func WaitUntilVolumeAttached(ctx aws.Context, conn *ec2.EC2, volumeId string) error { volumeInput := ec2.DescribeVolumesInput{ VolumeIds: []*string{&volumeId}, } err := WaitForVolumeToBeAttached(conn, ctx, &volumeInput, getWaiterOptions()...) return err }
go
func WaitUntilVolumeAttached(ctx aws.Context, conn *ec2.EC2, volumeId string) error { volumeInput := ec2.DescribeVolumesInput{ VolumeIds: []*string{&volumeId}, } err := WaitForVolumeToBeAttached(conn, ctx, &volumeInput, getWaiterOptions()...) return err }
[ "func", "WaitUntilVolumeAttached", "(", "ctx", "aws", ".", "Context", ",", "conn", "*", "ec2", ".", "EC2", ",", "volumeId", "string", ")", "error", "{", "volumeInput", ":=", "ec2", ".", "DescribeVolumesInput", "{", "VolumeIds", ":", "[", "]", "*", "string"...
// Wrappers for our custom AWS waiters
[ "Wrappers", "for", "our", "custom", "AWS", "waiters" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/state.go#L109-L119
165,024
hashicorp/packer
builder/parallels/common/step_shutdown.go
Run
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) vmName := state.Get("vmName").(string) if s.Command != "" { ui.Say("Gracefully halting...
go
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) vmName := state.Get("vmName").(string) if s.Command != "" { ui.Say("Gracefully halting...
[ "func", "(", "s", "*", "StepShutdown", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "comm", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(", "packer...
// Run shuts down the VM.
[ "Run", "shuts", "down", "the", "VM", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/step_shutdown.go#L32-L88
165,025
hashicorp/packer
packer/progressbar.go
TrackProgress
func (*NoopProgressTracker) TrackProgress(_ string, _, _ int64, stream io.ReadCloser) io.ReadCloser { return stream }
go
func (*NoopProgressTracker) TrackProgress(_ string, _, _ int64, stream io.ReadCloser) io.ReadCloser { return stream }
[ "func", "(", "*", "NoopProgressTracker", ")", "TrackProgress", "(", "_", "string", ",", "_", ",", "_", "int64", ",", "stream", "io", ".", "ReadCloser", ")", "io", ".", "ReadCloser", "{", "return", "stream", "\n", "}" ]
// TrackProgress returns stream
[ "TrackProgress", "returns", "stream" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/progressbar.go#L87-L89
165,026
hashicorp/packer
builder/parallels/common/prlctl_config.go
Prepare
func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error { if c.Prlctl == nil { c.Prlctl = make([][]string, 0) } return nil }
go
func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error { if c.Prlctl == nil { c.Prlctl = make([][]string, 0) } return nil }
[ "func", "(", "c", "*", "PrlctlConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ")", "[", "]", "error", "{", "if", "c", ".", "Prlctl", "==", "nil", "{", "c", ".", "Prlctl", "=", "make", "(", "[", "]", "[", "]", "string", ...
// Prepare sets the default value of "Prlctl" property.
[ "Prepare", "sets", "the", "default", "value", "of", "Prlctl", "property", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/prlctl_config.go#L14-L20
165,027
hashicorp/packer
common/powershell/powershell.go
Output
func (ps *PowerShellCmd) Output(fileContents string, params ...string) (string, error) { path, err := ps.getPowerShellPath() if err != nil { return "", fmt.Errorf("Cannot find PowerShell in the path") } filename, err := saveScript(fileContents) if err != nil { return "", err } debug := os.Getenv("PACKER_PO...
go
func (ps *PowerShellCmd) Output(fileContents string, params ...string) (string, error) { path, err := ps.getPowerShellPath() if err != nil { return "", fmt.Errorf("Cannot find PowerShell in the path") } filename, err := saveScript(fileContents) if err != nil { return "", err } debug := os.Getenv("PACKER_PO...
[ "func", "(", "ps", "*", "PowerShellCmd", ")", "Output", "(", "fileContents", "string", ",", "params", "...", "string", ")", "(", "string", ",", "error", ")", "{", "path", ",", "err", ":=", "ps", ".", "getPowerShellPath", "(", ")", "\n", "if", "err", ...
// Output runs the PowerShell command and returns its standard output.
[ "Output", "runs", "the", "PowerShell", "command", "and", "returns", "its", "standard", "output", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/powershell/powershell.go#L40-L102
165,028
hashicorp/packer
builder/docker/windows_container_communicator.go
Upload
func (c *WindowsContainerCommunicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error { // Create a temporary file to store the upload tempfile, err := ioutil.TempFile(c.HostDir, "upload") if err != nil { return err } defer os.Remove(tempfile.Name()) // Copy the contents to the temporary file _, err...
go
func (c *WindowsContainerCommunicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error { // Create a temporary file to store the upload tempfile, err := ioutil.TempFile(c.HostDir, "upload") if err != nil { return err } defer os.Remove(tempfile.Name()) // Copy the contents to the temporary file _, err...
[ "func", "(", "c", "*", "WindowsContainerCommunicator", ")", "Upload", "(", "dst", "string", ",", "src", "io", ".", "Reader", ",", "fi", "*", "os", ".", "FileInfo", ")", "error", "{", "// Create a temporary file to store the upload", "tempfile", ",", "err", ":=...
// Upload uses docker exec to copy the file from the host to the container
[ "Upload", "uses", "docker", "exec", "to", "copy", "the", "file", "from", "the", "host", "to", "the", "container" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/windows_container_communicator.go#L29-L65
165,029
hashicorp/packer
builder/docker/windows_container_communicator.go
Download
func (c *WindowsContainerCommunicator) Download(src string, dst io.Writer) error { log.Printf("Downloading file from container: %s:%s", c.ContainerID, src) // Copy file onto temp file on mounted volume inside container var stdout, stderr bytes.Buffer cmd := &packer.RemoteCmd{ Command: fmt.Sprintf("Copy-Item -Path...
go
func (c *WindowsContainerCommunicator) Download(src string, dst io.Writer) error { log.Printf("Downloading file from container: %s:%s", c.ContainerID, src) // Copy file onto temp file on mounted volume inside container var stdout, stderr bytes.Buffer cmd := &packer.RemoteCmd{ Command: fmt.Sprintf("Copy-Item -Path...
[ "func", "(", "c", "*", "WindowsContainerCommunicator", ")", "Download", "(", "src", "string", ",", "dst", "io", ".", "Writer", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "c", ".", "ContainerID", ",", "src", ")", "\n", "// Copy file ...
// Download pulls a file out of a container using `docker cp`. We have a source // path and want to write to an io.Writer
[ "Download", "pulls", "a", "file", "out", "of", "a", "container", "using", "docker", "cp", ".", "We", "have", "a", "source", "path", "and", "want", "to", "write", "to", "an", "io", ".", "Writer" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/windows_container_communicator.go#L155-L191
165,030
hashicorp/packer
common/template/funcs.go
DeprecatedTemplateFunc
func DeprecatedTemplateFunc(funcName, useInstead string, deprecated func(string) string) func(string) string { once := sync.Once{} return func(in string) string { once.Do(func() { log.Printf("[WARN]: the `%s` template func is deprecated, please use %s instead", funcName, useInstead) }) return deprecated(...
go
func DeprecatedTemplateFunc(funcName, useInstead string, deprecated func(string) string) func(string) string { once := sync.Once{} return func(in string) string { once.Do(func() { log.Printf("[WARN]: the `%s` template func is deprecated, please use %s instead", funcName, useInstead) }) return deprecated(...
[ "func", "DeprecatedTemplateFunc", "(", "funcName", ",", "useInstead", "string", ",", "deprecated", "func", "(", "string", ")", "string", ")", "func", "(", "string", ")", "string", "{", "once", ":=", "sync", ".", "Once", "{", "}", "\n", "return", "func", ...
// DeprecatedTemplateFunc wraps a template func to warn users that it's // deprecated. The deprecation warning is called only once.
[ "DeprecatedTemplateFunc", "wraps", "a", "template", "func", "to", "warn", "users", "that", "it", "s", "deprecated", ".", "The", "deprecation", "warning", "is", "called", "only", "once", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/template/funcs.go#L10-L19
165,031
hashicorp/packer
builder/oracle/oci/driver_oci.go
NewDriverOCI
func NewDriverOCI(cfg *Config) (Driver, error) { coreClient, err := core.NewComputeClientWithConfigurationProvider(cfg.ConfigProvider) if err != nil { return nil, err } vcnClient, err := core.NewVirtualNetworkClientWithConfigurationProvider(cfg.ConfigProvider) if err != nil { return nil, err } return &driv...
go
func NewDriverOCI(cfg *Config) (Driver, error) { coreClient, err := core.NewComputeClientWithConfigurationProvider(cfg.ConfigProvider) if err != nil { return nil, err } vcnClient, err := core.NewVirtualNetworkClientWithConfigurationProvider(cfg.ConfigProvider) if err != nil { return nil, err } return &driv...
[ "func", "NewDriverOCI", "(", "cfg", "*", "Config", ")", "(", "Driver", ",", "error", ")", "{", "coreClient", ",", "err", ":=", "core", ".", "NewComputeClientWithConfigurationProvider", "(", "cfg", ".", "ConfigProvider", ")", "\n", "if", "err", "!=", "nil", ...
// NewDriverOCI Creates a new driverOCI with a connected compute client and a connected vcn client.
[ "NewDriverOCI", "Creates", "a", "new", "driverOCI", "with", "a", "connected", "compute", "client", "and", "a", "connected", "vcn", "client", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/oracle/oci/driver_oci.go#L22-L38
165,032
hashicorp/packer
builder/oracle/oci/driver_oci.go
DeleteImage
func (d *driverOCI) DeleteImage(ctx context.Context, id string) error { _, err := d.computeClient.DeleteImage(ctx, core.DeleteImageRequest{ImageId: &id}) return err }
go
func (d *driverOCI) DeleteImage(ctx context.Context, id string) error { _, err := d.computeClient.DeleteImage(ctx, core.DeleteImageRequest{ImageId: &id}) return err }
[ "func", "(", "d", "*", "driverOCI", ")", "DeleteImage", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "_", ",", "err", ":=", "d", ".", "computeClient", ".", "DeleteImage", "(", "ctx", ",", "core", ".", "DeleteImageReque...
// DeleteImage deletes a custom image.
[ "DeleteImage", "deletes", "a", "custom", "image", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/oracle/oci/driver_oci.go#L94-L97
165,033
hashicorp/packer
builder/oracle/oci/driver_oci.go
waitForResourceToReachState
func waitForResourceToReachState(getResourceState func(string) (string, error), id string, waitStates []string, terminalState string, maxRetries int, waitDuration time.Duration) error { for i := 0; maxRetries == 0 || i < maxRetries; i++ { state, err := getResourceState(id) if err != nil { return err } if s...
go
func waitForResourceToReachState(getResourceState func(string) (string, error), id string, waitStates []string, terminalState string, maxRetries int, waitDuration time.Duration) error { for i := 0; maxRetries == 0 || i < maxRetries; i++ { state, err := getResourceState(id) if err != nil { return err } if s...
[ "func", "waitForResourceToReachState", "(", "getResourceState", "func", "(", "string", ")", "(", "string", ",", "error", ")", ",", "id", "string", ",", "waitStates", "[", "]", "string", ",", "terminalState", "string", ",", "maxRetries", "int", ",", "waitDurati...
// WaitForResourceToReachState checks the response of a request through a // polled get and waits until the desired state or until the max retried has // been reached.
[ "WaitForResourceToReachState", "checks", "the", "response", "of", "a", "request", "through", "a", "polled", "get", "and", "waits", "until", "the", "desired", "state", "or", "until", "the", "max", "retried", "has", "been", "reached", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/oracle/oci/driver_oci.go#L189-L205
165,034
hashicorp/packer
builder/oracle/oci/driver_oci.go
stringSliceContains
func stringSliceContains(slice []string, value string) bool { for _, elem := range slice { if elem == value { return true } } return false }
go
func stringSliceContains(slice []string, value string) bool { for _, elem := range slice { if elem == value { return true } } return false }
[ "func", "stringSliceContains", "(", "slice", "[", "]", "string", ",", "value", "string", ")", "bool", "{", "for", "_", ",", "elem", ":=", "range", "slice", "{", "if", "elem", "==", "value", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return",...
// stringSliceContains loops through a slice of strings returning a boolean // based on whether a given value is contained in the slice.
[ "stringSliceContains", "loops", "through", "a", "slice", "of", "strings", "returning", "a", "boolean", "based", "on", "whether", "a", "given", "value", "is", "contained", "in", "the", "slice", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/oracle/oci/driver_oci.go#L209-L216
165,035
hashicorp/packer
packer/plugin/server.go
Server
func Server() (*packrpc.Server, error) { if os.Getenv(MagicCookieKey) != MagicCookieValue { return nil, errors.New( "Please do not execute plugins directly. Packer will execute these for you.") } // If there is no explicit number of Go threads to use, then set it if os.Getenv("GOMAXPROCS") == "" { runtime.G...
go
func Server() (*packrpc.Server, error) { if os.Getenv(MagicCookieKey) != MagicCookieValue { return nil, errors.New( "Please do not execute plugins directly. Packer will execute these for you.") } // If there is no explicit number of Go threads to use, then set it if os.Getenv("GOMAXPROCS") == "" { runtime.G...
[ "func", "Server", "(", ")", "(", "*", "packrpc", ".", "Server", ",", "error", ")", "{", "if", "os", ".", "Getenv", "(", "MagicCookieKey", ")", "!=", "MagicCookieValue", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}...
// Server waits for a connection to this plugin and returns a Packer // RPC server that you can use to register components and serve them.
[ "Server", "waits", "for", "a", "connection", "to", "this", "plugin", "and", "returns", "a", "Packer", "RPC", "server", "that", "you", "can", "use", "to", "register", "components", "and", "serve", "them", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/plugin/server.go#L43-L105
165,036
hashicorp/packer
builder/triton/driver_triton.go
WaitForMachineState
func (d *driverTriton) WaitForMachineState(machineId string, state string, timeout time.Duration) error { return waitFor( func() (bool, error) { computeClient, _ := d.client.Compute() machine, err := computeClient.Instances().Get(context.Background(), &compute.GetInstanceInput{ ID: machineId, }) if m...
go
func (d *driverTriton) WaitForMachineState(machineId string, state string, timeout time.Duration) error { return waitFor( func() (bool, error) { computeClient, _ := d.client.Compute() machine, err := computeClient.Instances().Get(context.Background(), &compute.GetInstanceInput{ ID: machineId, }) if m...
[ "func", "(", "d", "*", "driverTriton", ")", "WaitForMachineState", "(", "machineId", "string", ",", "state", "string", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "return", "waitFor", "(", "func", "(", ")", "(", "bool", ",", "error", ")",...
// waitForMachineState uses the supplied client to wait for the state of // the machine with the given ID to reach the state described in state. // If timeout is reached before the machine reaches the required state, an // error is returned. If the machine reaches the target state within the // timeout, nil is returned...
[ "waitForMachineState", "uses", "the", "supplied", "client", "to", "wait", "for", "the", "state", "of", "the", "machine", "with", "the", "given", "ID", "to", "reach", "the", "state", "described", "in", "state", ".", "If", "timeout", "is", "reached", "before",...
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/triton/driver_triton.go#L149-L164
165,037
hashicorp/packer
builder/triton/driver_triton.go
WaitForMachineDeletion
func (d *driverTriton) WaitForMachineDeletion(machineId string, timeout time.Duration) error { return waitFor( func() (bool, error) { computeClient, _ := d.client.Compute() _, err := computeClient.Instances().Get(context.Background(), &compute.GetInstanceInput{ ID: machineId, }) if err != nil { /...
go
func (d *driverTriton) WaitForMachineDeletion(machineId string, timeout time.Duration) error { return waitFor( func() (bool, error) { computeClient, _ := d.client.Compute() _, err := computeClient.Instances().Get(context.Background(), &compute.GetInstanceInput{ ID: machineId, }) if err != nil { /...
[ "func", "(", "d", "*", "driverTriton", ")", "WaitForMachineDeletion", "(", "machineId", "string", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "return", "waitFor", "(", "func", "(", ")", "(", "bool", ",", "error", ")", "{", "computeClient", ...
// waitForMachineDeletion uses the supplied client to wait for the machine // with the given ID to be deleted. It is expected that the API call to delete // the machine has already been issued at this point.
[ "waitForMachineDeletion", "uses", "the", "supplied", "client", "to", "wait", "for", "the", "machine", "with", "the", "given", "ID", "to", "be", "deleted", ".", "It", "is", "expected", "that", "the", "API", "call", "to", "delete", "the", "machine", "has", "...
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/triton/driver_triton.go#L169-L190
165,038
hashicorp/packer
builder/vmware/common/driver_parser.go
uncomment
func uncomment(eof sentinelSignaller, in <-chan byte) (chan byte, sentinelSignaller) { out := make(chan byte) eoc := make(sentinelSignaller) go func(in <-chan byte, out chan byte) { var endofline bool for stillReading := true; stillReading; { select { case <-eof: stillReading = false case ch := <-i...
go
func uncomment(eof sentinelSignaller, in <-chan byte) (chan byte, sentinelSignaller) { out := make(chan byte) eoc := make(sentinelSignaller) go func(in <-chan byte, out chan byte) { var endofline bool for stillReading := true; stillReading; { select { case <-eof: stillReading = false case ch := <-i...
[ "func", "uncomment", "(", "eof", "sentinelSignaller", ",", "in", "<-", "chan", "byte", ")", "(", "chan", "byte", ",", "sentinelSignaller", ")", "{", "out", ":=", "make", "(", "chan", "byte", ")", "\n", "eoc", ":=", "make", "(", "sentinelSignaller", ")", ...
/** low-level parsing */ // strip the comments and extraneous newlines from a byte channel
[ "low", "-", "level", "parsing", "strip", "the", "comments", "and", "extraneous", "newlines", "from", "a", "byte", "channel" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L20-L47
165,039
hashicorp/packer
builder/vmware/common/driver_parser.go
parseTokenParameter
func parseTokenParameter(in chan string) tkParameter { var result tkParameter for { token := <-in if result.name == "" { result.name = token continue } switch token { case "{": fallthrough case "}": fallthrough case ";": goto leave default: result.operand = append(result.operand, tok...
go
func parseTokenParameter(in chan string) tkParameter { var result tkParameter for { token := <-in if result.name == "" { result.name = token continue } switch token { case "{": fallthrough case "}": fallthrough case ";": goto leave default: result.operand = append(result.operand, tok...
[ "func", "parseTokenParameter", "(", "in", "chan", "string", ")", "tkParameter", "{", "var", "result", "tkParameter", "\n", "for", "{", "token", ":=", "<-", "in", "\n", "if", "result", ".", "name", "==", "\"", "\"", "{", "result", ".", "name", "=", "tok...
// convert a channel of pseudo-tokens into an tkParameter struct
[ "convert", "a", "channel", "of", "pseudo", "-", "tokens", "into", "an", "tkParameter", "struct" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L156-L177
165,040
hashicorp/packer
builder/vmware/common/driver_parser.go
parseDhcpConfig
func parseDhcpConfig(eof sentinelSignaller, in chan string) (tkGroup, error) { var tokens []string var result tkGroup toParameter := func(tokens []string) tkParameter { out := make(chan string) go func(out chan string) { for _, v := range tokens { out <- v } out <- ";" }(out) return parseTokenP...
go
func parseDhcpConfig(eof sentinelSignaller, in chan string) (tkGroup, error) { var tokens []string var result tkGroup toParameter := func(tokens []string) tkParameter { out := make(chan string) go func(out chan string) { for _, v := range tokens { out <- v } out <- ";" }(out) return parseTokenP...
[ "func", "parseDhcpConfig", "(", "eof", "sentinelSignaller", ",", "in", "chan", "string", ")", "(", "tkGroup", ",", "error", ")", "{", "var", "tokens", "[", "]", "string", "\n", "var", "result", "tkGroup", "\n\n", "toParameter", ":=", "func", "(", "tokens",...
// convert a channel of pseudo-tokens into an tkGroup tree */
[ "convert", "a", "channel", "of", "pseudo", "-", "tokens", "into", "an", "tkGroup", "tree" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L180-L226
165,041
hashicorp/packer
builder/vmware/common/driver_parser.go
parseNetworkingCommand_answer
func parseNetworkingCommand_answer(row []string) (*networkingCommandEntry, error) { if len(row) != 2 { return nil, fmt.Errorf("Expected %d arguments. Received only %d.", 2, len(row)) } vnet := networkingVNET{value: row[0]} if !vnet.Valid() { return nil, fmt.Errorf("Invalid format for VNET.") } value := row[1]...
go
func parseNetworkingCommand_answer(row []string) (*networkingCommandEntry, error) { if len(row) != 2 { return nil, fmt.Errorf("Expected %d arguments. Received only %d.", 2, len(row)) } vnet := networkingVNET{value: row[0]} if !vnet.Valid() { return nil, fmt.Errorf("Invalid format for VNET.") } value := row[1]...
[ "func", "parseNetworkingCommand_answer", "(", "row", "[", "]", "string", ")", "(", "*", "networkingCommandEntry", ",", "error", ")", "{", "if", "len", "(", "row", ")", "!=", "2", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", ...
// networking command entry parsers
[ "networking", "command", "entry", "parsers" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L1442-L1454
165,042
hashicorp/packer
builder/vmware/common/driver_parser.go
ReadNetworkingConfig
func ReadNetworkingConfig(fd *os.File) (NetworkingConfig, error) { // start piecing together different parts of the file fromfile, eof := consumeFile(fd) tokenized, eot := tokenizeNetworkingConfig(eof, fromfile) rows, eos := splitNetworkingConfig(eot, tokenized) entries, eop := parseNetworkingConfig(eos, rows) /...
go
func ReadNetworkingConfig(fd *os.File) (NetworkingConfig, error) { // start piecing together different parts of the file fromfile, eof := consumeFile(fd) tokenized, eot := tokenizeNetworkingConfig(eof, fromfile) rows, eos := splitNetworkingConfig(eot, tokenized) entries, eop := parseNetworkingConfig(eos, rows) /...
[ "func", "ReadNetworkingConfig", "(", "fd", "*", "os", ".", "File", ")", "(", "NetworkingConfig", ",", "error", ")", "{", "// start piecing together different parts of the file", "fromfile", ",", "eof", ":=", "consumeFile", "(", "fd", ")", "\n", "tokenized", ",", ...
// Constructor for networking file
[ "Constructor", "for", "networking", "file" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L1816-L1838
165,043
hashicorp/packer
builder/vmware/common/driver_parser.go
consumeFile
func consumeFile(fd *os.File) (chan byte, sentinelSignaller) { fromfile := make(chan byte) eof := make(sentinelSignaller) go func() { b := make([]byte, 1) for { _, err := fd.Read(b) if err == io.EOF { break } fromfile <- b[0] } close(eof) }() return fromfile, eof }
go
func consumeFile(fd *os.File) (chan byte, sentinelSignaller) { fromfile := make(chan byte) eof := make(sentinelSignaller) go func() { b := make([]byte, 1) for { _, err := fd.Read(b) if err == io.EOF { break } fromfile <- b[0] } close(eof) }() return fromfile, eof }
[ "func", "consumeFile", "(", "fd", "*", "os", ".", "File", ")", "(", "chan", "byte", ",", "sentinelSignaller", ")", "{", "fromfile", ":=", "make", "(", "chan", "byte", ")", "\n", "eof", ":=", "make", "(", "sentinelSignaller", ")", "\n", "go", "func", ...
/** generic async file reader */
[ "generic", "async", "file", "reader" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver_parser.go#L1958-L1973
165,044
hashicorp/packer
builder/googlecompute/step_check_existing_image.go
Run
func (s *StepCheckExistingImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Checking image does not exist...") c.imageAlreadyExists = d.ImageExists(c.ImageName) if !c.Pack...
go
func (s *StepCheckExistingImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Checking image does not exist...") c.imageAlreadyExists = d.ImageExists(c.ImageName) if !c.Pack...
[ "func", "(", "s", "*", "StepCheckExistingImage", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "c", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(", ...
// Run executes the Packer build step that checks if the image already exists.
[ "Run", "executes", "the", "Packer", "build", "step", "that", "checks", "if", "the", "image", "already", "exists", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/googlecompute/step_check_existing_image.go#L16-L31
165,045
hashicorp/packer
builder/openstack/run_config.go
getImageVisibility
func getImageVisibility(visibility string) (*images.ImageVisibility, error) { visibilities := [...]images.ImageVisibility{ images.ImageVisibilityPublic, images.ImageVisibilityPrivate, images.ImageVisibilityCommunity, images.ImageVisibilityShared, } for _, v := range visibilities { if string(v) == visibili...
go
func getImageVisibility(visibility string) (*images.ImageVisibility, error) { visibilities := [...]images.ImageVisibility{ images.ImageVisibilityPublic, images.ImageVisibilityPrivate, images.ImageVisibilityCommunity, images.ImageVisibilityShared, } for _, v := range visibilities { if string(v) == visibili...
[ "func", "getImageVisibility", "(", "visibility", "string", ")", "(", "*", "images", ".", "ImageVisibility", ",", "error", ")", "{", "visibilities", ":=", "[", "...", "]", "images", ".", "ImageVisibility", "{", "images", ".", "ImageVisibilityPublic", ",", "imag...
// Retrieve the specific ImageVisibility using the exported const from images
[ "Retrieve", "the", "specific", "ImageVisibility", "using", "the", "exported", "const", "from", "images" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/openstack/run_config.go#L175-L190
165,046
hashicorp/packer
builder/triton/source_machine_config.go
Prepare
func (c *SourceMachineConfig) Prepare(ctx *interpolate.Context) []error { var errs []error if c.MachinePackage == "" { errs = append(errs, fmt.Errorf("A source_machine_package must be specified")) } if c.MachineImage != "" && c.MachineImageFilters.Name != "" { errs = append(errs, fmt.Errorf("You cannot specif...
go
func (c *SourceMachineConfig) Prepare(ctx *interpolate.Context) []error { var errs []error if c.MachinePackage == "" { errs = append(errs, fmt.Errorf("A source_machine_package must be specified")) } if c.MachineImage != "" && c.MachineImageFilters.Name != "" { errs = append(errs, fmt.Errorf("You cannot specif...
[ "func", "(", "c", "*", "SourceMachineConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ")", "[", "]", "error", "{", "var", "errs", "[", "]", "error", "\n\n", "if", "c", ".", "MachinePackage", "==", "\"", "\"", "{", "errs", "=",...
// Prepare performs basic validation on a SourceMachineConfig struct.
[ "Prepare", "performs", "basic", "validation", "on", "a", "SourceMachineConfig", "struct", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/triton/source_machine_config.go#L38-L66
165,047
hashicorp/packer
packer/hook.go
Run
func (h *DispatchHook) Run(ctx context.Context, name string, ui Ui, comm Communicator, data interface{}) error { hooks, ok := h.Mapping[name] if !ok { // No hooks for that name. No problem. return nil } for _, hook := range hooks { if err := ctx.Err(); err != nil { return err } if err := hook.Run(ct...
go
func (h *DispatchHook) Run(ctx context.Context, name string, ui Ui, comm Communicator, data interface{}) error { hooks, ok := h.Mapping[name] if !ok { // No hooks for that name. No problem. return nil } for _, hook := range hooks { if err := ctx.Err(); err != nil { return err } if err := hook.Run(ct...
[ "func", "(", "h", "*", "DispatchHook", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "ui", "Ui", ",", "comm", "Communicator", ",", "data", "interface", "{", "}", ")", "error", "{", "hooks", ",", "ok", ":=", "h", "."...
// Runs the hook with the given name by dispatching it to the proper // hooks if a mapping exists. If a mapping doesn't exist, then nothing // happens.
[ "Runs", "the", "hook", "with", "the", "given", "name", "by", "dispatching", "it", "to", "the", "proper", "hooks", "if", "a", "mapping", "exists", ".", "If", "a", "mapping", "doesn", "t", "exist", "then", "nothing", "happens", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/hook.go#L35-L54
165,048
hashicorp/packer
builder/proxmox/builder.go
getVMIP
func getVMIP(state multistep.StateBag) (string, error) { c := state.Get("proxmoxClient").(*proxmox.Client) vmRef := state.Get("vmRef").(*proxmox.VmRef) ifs, err := c.GetVmAgentNetworkInterfaces(vmRef) if err != nil { return "", err } // TODO: Do something smarter here? Allow specifying interface? Or address f...
go
func getVMIP(state multistep.StateBag) (string, error) { c := state.Get("proxmoxClient").(*proxmox.Client) vmRef := state.Get("vmRef").(*proxmox.VmRef) ifs, err := c.GetVmAgentNetworkInterfaces(vmRef) if err != nil { return "", err } // TODO: Do something smarter here? Allow specifying interface? Or address f...
[ "func", "getVMIP", "(", "state", "multistep", ".", "StateBag", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(", "*", "proxmox", ".", "Client", ")", "\n", "vmRef", ":=", "state", ".", "Get...
// Reads the first non-loopback interface's IP address from the VM. // qemu-guest-agent package must be installed on the VM
[ "Reads", "the", "first", "non", "-", "loopback", "interface", "s", "IP", "address", "from", "the", "VM", ".", "qemu", "-", "guest", "-", "agent", "package", "must", "be", "installed", "on", "the", "VM" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/proxmox/builder.go#L114-L135
165,049
hashicorp/packer
builder/docker/step_temp_dir.go
ConfigTmpDir
func ConfigTmpDir() (string, error) { if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" { return filepath.Abs(tmpdir) } configdir, err := packer.ConfigDir() if err != nil { return "", err } td := filepath.Join(configdir, "tmp") _, err = os.Stat(td) if os.IsNotExist(err) { if err = os.MkdirAll(td, 075...
go
func ConfigTmpDir() (string, error) { if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" { return filepath.Abs(tmpdir) } configdir, err := packer.ConfigDir() if err != nil { return "", err } td := filepath.Join(configdir, "tmp") _, err = os.Stat(td) if os.IsNotExist(err) { if err = os.MkdirAll(td, 075...
[ "func", "ConfigTmpDir", "(", ")", "(", "string", ",", "error", ")", "{", "if", "tmpdir", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "tmpdir", "!=", "\"", "\"", "{", "return", "filepath", ".", "Abs", "(", "tmpdir", ")", "\n", "}", "\n",...
// ConfigTmpDir returns the configuration tmp directory for Docker
[ "ConfigTmpDir", "returns", "the", "configuration", "tmp", "directory", "for", "Docker" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/step_temp_dir.go#L20-L38
165,050
hashicorp/packer
builder/parallels/common/tools_config.go
Prepare
func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error { if c.ParallelsToolsMode == "" { c.ParallelsToolsMode = ParallelsToolsModeUpload } if c.ParallelsToolsGuestPath == "" { c.ParallelsToolsGuestPath = "prl-tools-{{.Flavor}}.iso" } validMode := false validModes := []string{ ParallelsToolsModeDi...
go
func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error { if c.ParallelsToolsMode == "" { c.ParallelsToolsMode = ParallelsToolsModeUpload } if c.ParallelsToolsGuestPath == "" { c.ParallelsToolsGuestPath = "prl-tools-{{.Flavor}}.iso" } validMode := false validModes := []string{ ParallelsToolsModeDi...
[ "func", "(", "c", "*", "ToolsConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ")", "[", "]", "error", "{", "if", "c", ".", "ParallelsToolsMode", "==", "\"", "\"", "{", "c", ".", "ParallelsToolsMode", "=", "ParallelsToolsModeUpload",...
// Prepare validates & sets up configuration options related to Parallels Tools.
[ "Prepare", "validates", "&", "sets", "up", "configuration", "options", "related", "to", "Parallels", "Tools", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/tools_config.go#L26-L63
165,051
hashicorp/packer
builder/hyperv/common/artifact.go
NewArtifact
func NewArtifact(dir string) (packer.Artifact, error) { files := make([]string, 0, 5) visit := func(path string, info os.FileInfo, err error) error { if err != nil { return err } if !info.IsDir() { files = append(files, path) } return nil } if err := filepath.Walk(dir, visit); err != nil { retur...
go
func NewArtifact(dir string) (packer.Artifact, error) { files := make([]string, 0, 5) visit := func(path string, info os.FileInfo, err error) error { if err != nil { return err } if !info.IsDir() { files = append(files, path) } return nil } if err := filepath.Walk(dir, visit); err != nil { retur...
[ "func", "NewArtifact", "(", "dir", "string", ")", "(", "packer", ".", "Artifact", ",", "error", ")", "{", "files", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "5", ")", "\n", "visit", ":=", "func", "(", "path", "string", ",", "info", "o...
// NewArtifact returns a hyperv artifact containing the files // in the given directory.
[ "NewArtifact", "returns", "a", "hyperv", "artifact", "containing", "the", "files", "in", "the", "given", "directory", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/artifact.go#L23-L44
165,052
hashicorp/packer
builder/docker/communicator.go
Upload
func (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error { if fi == nil { return c.uploadReader(dst, src) } return c.uploadFile(dst, src, fi) }
go
func (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error { if fi == nil { return c.uploadReader(dst, src) } return c.uploadFile(dst, src, fi) }
[ "func", "(", "c", "*", "Communicator", ")", "Upload", "(", "dst", "string", ",", "src", "io", ".", "Reader", ",", "fi", "*", "os", ".", "FileInfo", ")", "error", "{", "if", "fi", "==", "nil", "{", "return", "c", ".", "uploadReader", "(", "dst", "...
// Upload uploads a file to the docker container
[ "Upload", "uploads", "a", "file", "to", "the", "docker", "container" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/communicator.go#L81-L86
165,053
hashicorp/packer
builder/docker/communicator.go
uploadReader
func (c *Communicator) uploadReader(dst string, src io.Reader) error { // Create a temporary file to store the upload tempfile, err := ioutil.TempFile(c.HostDir, "upload") if err != nil { return fmt.Errorf("Failed to open temp file for writing: %s", err) } defer os.Remove(tempfile.Name()) defer tempfile.Close()...
go
func (c *Communicator) uploadReader(dst string, src io.Reader) error { // Create a temporary file to store the upload tempfile, err := ioutil.TempFile(c.HostDir, "upload") if err != nil { return fmt.Errorf("Failed to open temp file for writing: %s", err) } defer os.Remove(tempfile.Name()) defer tempfile.Close()...
[ "func", "(", "c", "*", "Communicator", ")", "uploadReader", "(", "dst", "string", ",", "src", "io", ".", "Reader", ")", "error", "{", "// Create a temporary file to store the upload", "tempfile", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "c", ".", "H...
// uploadReader writes an io.Reader to a temporary file before uploading
[ "uploadReader", "writes", "an", "io", ".", "Reader", "to", "a", "temporary", "file", "before", "uploading" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/communicator.go#L89-L107
165,054
hashicorp/packer
builder/docker/communicator.go
uploadFile
func (c *Communicator) uploadFile(dst string, src io.Reader, fi *os.FileInfo) error { // command format: docker cp /path/to/infile containerid:/path/to/outfile log.Printf("Copying to %s on container %s.", dst, c.ContainerID) localCmd := exec.Command("docker", "cp", "-", fmt.Sprintf("%s:%s", c.ContainerID, filepat...
go
func (c *Communicator) uploadFile(dst string, src io.Reader, fi *os.FileInfo) error { // command format: docker cp /path/to/infile containerid:/path/to/outfile log.Printf("Copying to %s on container %s.", dst, c.ContainerID) localCmd := exec.Command("docker", "cp", "-", fmt.Sprintf("%s:%s", c.ContainerID, filepat...
[ "func", "(", "c", "*", "Communicator", ")", "uploadFile", "(", "dst", "string", ",", "src", "io", ".", "Reader", ",", "fi", "*", "os", ".", "FileInfo", ")", "error", "{", "// command format: docker cp /path/to/infile containerid:/path/to/outfile", "log", ".", "P...
// uploadFile uses docker cp to copy the file from the host to the container
[ "uploadFile", "uses", "docker", "cp", "to", "copy", "the", "file", "from", "the", "host", "to", "the", "container" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/communicator.go#L110-L165
165,055
hashicorp/packer
builder/docker/communicator.go
Download
func (c *Communicator) Download(src string, dst io.Writer) error { log.Printf("Downloading file from container: %s:%s", c.ContainerID, src) localCmd := exec.Command("docker", "cp", fmt.Sprintf("%s:%s", c.ContainerID, src), "-") pipe, err := localCmd.StdoutPipe() if err != nil { return fmt.Errorf("Failed to open ...
go
func (c *Communicator) Download(src string, dst io.Writer) error { log.Printf("Downloading file from container: %s:%s", c.ContainerID, src) localCmd := exec.Command("docker", "cp", fmt.Sprintf("%s:%s", c.ContainerID, src), "-") pipe, err := localCmd.StdoutPipe() if err != nil { return fmt.Errorf("Failed to open ...
[ "func", "(", "c", "*", "Communicator", ")", "Download", "(", "src", "string", ",", "dst", "io", ".", "Writer", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "c", ".", "ContainerID", ",", "src", ")", "\n", "localCmd", ":=", "exec", ...
// Download pulls a file out of a container using `docker cp`. We have a source // path and want to write to an io.Writer, not a file. We use - to make docker // cp to write to stdout, and then copy the stream to our destination io.Writer.
[ "Download", "pulls", "a", "file", "out", "of", "a", "container", "using", "docker", "cp", ".", "We", "have", "a", "source", "path", "and", "want", "to", "write", "to", "an", "io", ".", "Writer", "not", "a", "file", ".", "We", "use", "-", "to", "mak...
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/communicator.go#L227-L275
165,056
hashicorp/packer
builder/docker/communicator.go
run
func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin io.WriteCloser, stdout, stderr io.ReadCloser) { // For Docker, remote communication must be serialized since it // only supports single execution. c.lock.Lock() defer c.lock.Unlock() wg := sync.WaitGroup{} repeat := func(w io.Writer, r io....
go
func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin io.WriteCloser, stdout, stderr io.ReadCloser) { // For Docker, remote communication must be serialized since it // only supports single execution. c.lock.Lock() defer c.lock.Unlock() wg := sync.WaitGroup{} repeat := func(w io.Writer, r io....
[ "func", "(", "c", "*", "Communicator", ")", "run", "(", "cmd", "*", "exec", ".", "Cmd", ",", "remote", "*", "packer", ".", "RemoteCmd", ",", "stdin", "io", ".", "WriteCloser", ",", "stdout", ",", "stderr", "io", ".", "ReadCloser", ")", "{", "// For D...
// Runs the given command and blocks until completion
[ "Runs", "the", "given", "command", "and", "blocks", "until", "completion" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/docker/communicator.go#L282-L338
165,057
hashicorp/packer
builder/amazon/common/step_ami_region_copy.go
amiRegionCopy
func amiRegionCopy(ctx context.Context, state multistep.StateBag, config *AccessConfig, name, imageId, target, source, keyId string, encrypt *bool) (string, []string, error) { snapshotIds := []string{} // Connect to the region where the AMI will be copied to session, err := config.Session() if err != nil { retu...
go
func amiRegionCopy(ctx context.Context, state multistep.StateBag, config *AccessConfig, name, imageId, target, source, keyId string, encrypt *bool) (string, []string, error) { snapshotIds := []string{} // Connect to the region where the AMI will be copied to session, err := config.Session() if err != nil { retu...
[ "func", "amiRegionCopy", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ",", "config", "*", "AccessConfig", ",", "name", ",", "imageId", ",", "target", ",", "source", ",", "keyId", "string", ",", "encrypt", "*", "bool", ...
// amiRegionCopy does a copy for the given AMI to the target region and // returns the resulting ID and snapshot IDs, or error.
[ "amiRegionCopy", "does", "a", "copy", "for", "the", "given", "AMI", "to", "the", "target", "region", "and", "returns", "the", "resulting", "ID", "and", "snapshot", "IDs", "or", "error", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/amazon/common/step_ami_region_copy.go#L100-L147
165,058
hashicorp/packer
provisioner/powershell/provisioner.go
extractScript
func extractScript(p *Provisioner) (string, error) { temp, err := tmp.File("powershell-provisioner") if err != nil { return "", err } defer temp.Close() writer := bufio.NewWriter(temp) for _, command := range p.config.Inline { log.Printf("Found command: %s", command) if _, err := writer.WriteString(command ...
go
func extractScript(p *Provisioner) (string, error) { temp, err := tmp.File("powershell-provisioner") if err != nil { return "", err } defer temp.Close() writer := bufio.NewWriter(temp) for _, command := range p.config.Inline { log.Printf("Found command: %s", command) if _, err := writer.WriteString(command ...
[ "func", "extractScript", "(", "p", "*", "Provisioner", ")", "(", "string", ",", "error", ")", "{", "temp", ",", "err", ":=", "tmp", ".", "File", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", ...
// Takes the inline scripts, concatenates them into a temporary file and // returns a string containing the location of said file.
[ "Takes", "the", "inline", "scripts", "concatenates", "them", "into", "a", "temporary", "file", "and", "returns", "a", "string", "containing", "the", "location", "of", "said", "file", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/provisioner/powershell/provisioner.go#L199-L218
165,059
hashicorp/packer
provisioner/powershell/provisioner.go
prepareEnvVars
func (p *Provisioner) prepareEnvVars(elevated bool) (err error) { // Collate all required env vars into a plain string with required // formatting applied flattenedEnvVars := p.createFlattenedEnvVars(elevated) // Create a powershell script on the target build fs containing the // flattened env vars err = p.upload...
go
func (p *Provisioner) prepareEnvVars(elevated bool) (err error) { // Collate all required env vars into a plain string with required // formatting applied flattenedEnvVars := p.createFlattenedEnvVars(elevated) // Create a powershell script on the target build fs containing the // flattened env vars err = p.upload...
[ "func", "(", "p", "*", "Provisioner", ")", "prepareEnvVars", "(", "elevated", "bool", ")", "(", "err", "error", ")", "{", "// Collate all required env vars into a plain string with required", "// formatting applied", "flattenedEnvVars", ":=", "p", ".", "createFlattenedEnv...
// Environment variables required within the remote environment are uploaded // within a PS script and then enabled by 'dot sourcing' the script // immediately prior to execution of the main command
[ "Environment", "variables", "required", "within", "the", "remote", "environment", "are", "uploaded", "within", "a", "PS", "script", "and", "then", "enabled", "by", "dot", "sourcing", "the", "script", "immediately", "prior", "to", "execution", "of", "the", "main"...
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/provisioner/powershell/provisioner.go#L292-L303
165,060
hashicorp/packer
packer/core.go
NewCore
func NewCore(c *CoreConfig) (*Core, error) { result := &Core{ Template: c.Template, components: c.Components, variables: c.Variables, version: c.Version, only: c.Only, except: c.Except, } if err := result.validate(); err != nil { return nil, err } if err := result.init(); err != nil ...
go
func NewCore(c *CoreConfig) (*Core, error) { result := &Core{ Template: c.Template, components: c.Components, variables: c.Variables, version: c.Version, only: c.Only, except: c.Except, } if err := result.validate(); err != nil { return nil, err } if err := result.init(); err != nil ...
[ "func", "NewCore", "(", "c", "*", "CoreConfig", ")", "(", "*", "Core", ",", "error", ")", "{", "result", ":=", "&", "Core", "{", "Template", ":", "c", ".", "Template", ",", "components", ":", "c", ".", "Components", ",", "variables", ":", "c", ".",...
// NewCore creates a new Core.
[ "NewCore", "creates", "a", "new", "Core", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/core.go#L67-L102
165,061
hashicorp/packer
packer/core.go
BuildNames
func (c *Core) BuildNames() []string { r := make([]string, 0, len(c.builds)) for n := range c.builds { r = append(r, n) } sort.Strings(r) return r }
go
func (c *Core) BuildNames() []string { r := make([]string, 0, len(c.builds)) for n := range c.builds { r = append(r, n) } sort.Strings(r) return r }
[ "func", "(", "c", "*", "Core", ")", "BuildNames", "(", ")", "[", "]", "string", "{", "r", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "c", ".", "builds", ")", ")", "\n", "for", "n", ":=", "range", "c", ".", "builds", "...
// BuildNames returns the builds that are available in this configured core.
[ "BuildNames", "returns", "the", "builds", "that", "are", "available", "in", "this", "configured", "core", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/core.go#L105-L113
165,062
hashicorp/packer
packer/core.go
Context
func (c *Core) Context() *interpolate.Context { return &interpolate.Context{ TemplatePath: c.Template.Path, UserVariables: c.variables, } }
go
func (c *Core) Context() *interpolate.Context { return &interpolate.Context{ TemplatePath: c.Template.Path, UserVariables: c.variables, } }
[ "func", "(", "c", "*", "Core", ")", "Context", "(", ")", "*", "interpolate", ".", "Context", "{", "return", "&", "interpolate", ".", "Context", "{", "TemplatePath", ":", "c", ".", "Template", ".", "Path", ",", "UserVariables", ":", "c", ".", "variables...
// Context returns an interpolation context.
[ "Context", "returns", "an", "interpolation", "context", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/core.go#L247-L252
165,063
hashicorp/packer
builder/openstack/step_create_image.go
WaitForImage
func WaitForImage(ctx context.Context, client *gophercloud.ServiceClient, imageId string) error { maxNumErrors := 10 numErrors := 0 for { if err := ctx.Err(); err != nil { return err } image, err := images.Get(client, imageId).Extract() if err != nil { errCode, ok := err.(*gophercloud.ErrUnexpectedRes...
go
func WaitForImage(ctx context.Context, client *gophercloud.ServiceClient, imageId string) error { maxNumErrors := 10 numErrors := 0 for { if err := ctx.Err(); err != nil { return err } image, err := images.Get(client, imageId).Extract() if err != nil { errCode, ok := err.(*gophercloud.ErrUnexpectedRes...
[ "func", "WaitForImage", "(", "ctx", "context", ".", "Context", ",", "client", "*", "gophercloud", ".", "ServiceClient", ",", "imageId", "string", ")", "error", "{", "maxNumErrors", ":=", "10", "\n", "numErrors", ":=", "0", "\n\n", "for", "{", "if", "err", ...
// WaitForImage waits for the given Image ID to become ready.
[ "WaitForImage", "waits", "for", "the", "given", "Image", "ID", "to", "become", "ready", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/openstack/step_create_image.go#L102-L134
165,064
hashicorp/packer
builder/vmware/common/driver.go
NewDriver
func NewDriver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error) { drivers := []Driver{} if dconfig.RemoteType != "" { drivers = []Driver{ &ESX5Driver{ Host: dconfig.RemoteHost, Port: dconfig.RemotePort, Username: dconfig.RemoteUser, Password: ...
go
func NewDriver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error) { drivers := []Driver{} if dconfig.RemoteType != "" { drivers = []Driver{ &ESX5Driver{ Host: dconfig.RemoteHost, Port: dconfig.RemotePort, Username: dconfig.RemoteUser, Password: ...
[ "func", "NewDriver", "(", "dconfig", "*", "DriverConfig", ",", "config", "*", "SSHConfig", ",", "vmName", "string", ")", "(", "Driver", ",", "error", ")", "{", "drivers", ":=", "[", "]", "Driver", "{", "}", "\n\n", "if", "dconfig", ".", "RemoteType", "...
// NewDriver returns a new driver implementation for this operating // system, or an error if the driver couldn't be initialized.
[ "NewDriver", "returns", "a", "new", "driver", "implementation", "for", "this", "operating", "system", "or", "an", "error", "if", "the", "driver", "couldn", "t", "be", "initialized", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver.go#L84-L160
165,065
hashicorp/packer
builder/vmware/common/driver.go
ReadDhcpConfig
func ReadDhcpConfig(path string) (DhcpConfiguration, error) { fd, err := os.Open(path) if err != nil { return nil, err } defer fd.Close() return ReadDhcpConfiguration(fd) }
go
func ReadDhcpConfig(path string) (DhcpConfiguration, error) { fd, err := os.Open(path) if err != nil { return nil, err } defer fd.Close() return ReadDhcpConfiguration(fd) }
[ "func", "ReadDhcpConfig", "(", "path", "string", ")", "(", "DhcpConfiguration", ",", "error", ")", "{", "fd", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", ...
// read the dhcp configuration out of the specified path
[ "read", "the", "dhcp", "configuration", "out", "of", "the", "specified", "path" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver.go#L246-L253
165,066
hashicorp/packer
builder/vmware/common/driver.go
readVMXConfig
func readVMXConfig(path string) (map[string]string, error) { f, err := os.Open(path) if err != nil { return map[string]string{}, err } defer f.Close() vmxBytes, err := ioutil.ReadAll(f) if err != nil { return map[string]string{}, err } return ParseVMX(string(vmxBytes)), nil }
go
func readVMXConfig(path string) (map[string]string, error) { f, err := os.Open(path) if err != nil { return map[string]string{}, err } defer f.Close() vmxBytes, err := ioutil.ReadAll(f) if err != nil { return map[string]string{}, err } return ParseVMX(string(vmxBytes)), nil }
[ "func", "readVMXConfig", "(", "path", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "map", "[", "string"...
// read the VMX configuration from the specified path
[ "read", "the", "VMX", "configuration", "from", "the", "specified", "path" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver.go#L256-L268
165,067
hashicorp/packer
builder/vmware/common/driver.go
readCustomDeviceName
func readCustomDeviceName(vmxData map[string]string) (string, error) { connectionType, ok := vmxData["ethernet0.connectiontype"] if !ok || connectionType != "custom" { return "", fmt.Errorf("Unable to determine the device name for the connection type : %s", connectionType) } device, ok := vmxData["ethernet0.vne...
go
func readCustomDeviceName(vmxData map[string]string) (string, error) { connectionType, ok := vmxData["ethernet0.connectiontype"] if !ok || connectionType != "custom" { return "", fmt.Errorf("Unable to determine the device name for the connection type : %s", connectionType) } device, ok := vmxData["ethernet0.vne...
[ "func", "readCustomDeviceName", "(", "vmxData", "map", "[", "string", "]", "string", ")", "(", "string", ",", "error", ")", "{", "connectionType", ",", "ok", ":=", "vmxData", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "||", "connectionType", "!=", "\...
// read the connection type out of a vmx configuration
[ "read", "the", "connection", "type", "out", "of", "a", "vmx", "configuration" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/vmware/common/driver.go#L271-L283
165,068
hashicorp/packer
builder/parallels/common/output_config.go
Prepare
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error { if c.OutputDir == "" { c.OutputDir = fmt.Sprintf("output-%s", pc.PackerBuildName) } var errs []error if path.IsAbs(c.OutputDir) { c.OutputDir = path.Clean(c.OutputDir) } else { wd, err := os.Getwd() if err != nil ...
go
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error { if c.OutputDir == "" { c.OutputDir = fmt.Sprintf("output-%s", pc.PackerBuildName) } var errs []error if path.IsAbs(c.OutputDir) { c.OutputDir = path.Clean(c.OutputDir) } else { wd, err := os.Getwd() if err != nil ...
[ "func", "(", "c", "*", "OutputConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ",", "pc", "*", "common", ".", "PackerConfig", ")", "[", "]", "error", "{", "if", "c", ".", "OutputDir", "==", "\"", "\"", "{", "c", ".", "Output...
// Prepare configures the output directory or returns an error if it already exists.
[ "Prepare", "configures", "the", "output", "directory", "or", "returns", "an", "error", "if", "it", "already", "exists", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/output_config.go#L18-L43
165,069
hashicorp/packer
builder/parallels/common/step_upload_parallels_tools.go
Run
func (s *StepUploadParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) ui := state.Get("ui").(packer.Ui) // If we're attaching then don't do this, since we attached. if s.ParallelsToolsMode != ParallelsToolsModeUpload { ...
go
func (s *StepUploadParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) ui := state.Get("ui").(packer.Ui) // If we're attaching then don't do this, since we attached. if s.ParallelsToolsMode != ParallelsToolsModeUpload { ...
[ "func", "(", "s", "*", "StepUploadParallelsTools", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "comm", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(...
// Run uploads the Parallels Tools ISO to the VM.
[ "Run", "uploads", "the", "Parallels", "Tools", "ISO", "to", "the", "VM", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/step_upload_parallels_tools.go#L41-L83
165,070
hashicorp/packer
builder/ncloud/step_create_block_storage_instance.go
NewStepCreateBlockStorageInstance
func NewStepCreateBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreateBlockStorageInstance { var step = &StepCreateBlockStorageInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, Error: func(e error) { ui.Error(e.Error()) }, Config: config, } step.CreateBl...
go
func NewStepCreateBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreateBlockStorageInstance { var step = &StepCreateBlockStorageInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, Error: func(e error) { ui.Error(e.Error()) }, Config: config, } step.CreateBl...
[ "func", "NewStepCreateBlockStorageInstance", "(", "conn", "*", "ncloud", ".", "Conn", ",", "ui", "packer", ".", "Ui", ",", "config", "*", "Config", ")", "*", "StepCreateBlockStorageInstance", "{", "var", "step", "=", "&", "StepCreateBlockStorageInstance", "{", "...
// NewStepCreateBlockStorageInstance make StepCreateBlockStorage struct to make extra block storage
[ "NewStepCreateBlockStorageInstance", "make", "StepCreateBlockStorage", "struct", "to", "make", "extra", "block", "storage" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/ncloud/step_create_block_storage_instance.go#L25-L36
165,071
hashicorp/packer
builder/openstack/ssh.go
CommHost
func CommHost( client *gophercloud.ServiceClient, sshinterface string, sshipversion string) func(multistep.StateBag) (string, error) { return func(state multistep.StateBag) (string, error) { s := state.Get("server").(*servers.Server) // If we have a specific interface, try that if sshinterface != "" { if ...
go
func CommHost( client *gophercloud.ServiceClient, sshinterface string, sshipversion string) func(multistep.StateBag) (string, error) { return func(state multistep.StateBag) (string, error) { s := state.Get("server").(*servers.Server) // If we have a specific interface, try that if sshinterface != "" { if ...
[ "func", "CommHost", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "sshinterface", "string", ",", "sshipversion", "string", ")", "func", "(", "multistep", ".", "StateBag", ")", "(", "string", ",", "error", ")", "{", "return", "func", "(", "s...
// CommHost looks up the host for the communicator.
[ "CommHost", "looks", "up", "the", "host", "for", "the", "communicator", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/openstack/ssh.go#L16-L59
165,072
hashicorp/packer
scripts/generate-plugins.go
listDirectories
func listDirectories(path string) ([]string, error) { names := []string{} items, err := ioutil.ReadDir(path) if err != nil { return names, err } for _, item := range items { // We only want directories if item.IsDir() { currentDir := filepath.Join(path, item.Name()) names = append(names, currentDir) ...
go
func listDirectories(path string) ([]string, error) { names := []string{} items, err := ioutil.ReadDir(path) if err != nil { return names, err } for _, item := range items { // We only want directories if item.IsDir() { currentDir := filepath.Join(path, item.Name()) names = append(names, currentDir) ...
[ "func", "listDirectories", "(", "path", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "names", ":=", "[", "]", "string", "{", "}", "\n", "items", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "path", ")", "\n", "if", "err", "...
// listDirectories recursively lists directories under the specified path
[ "listDirectories", "recursively", "lists", "directories", "under", "the", "specified", "path" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/scripts/generate-plugins.go#L117-L139
165,073
hashicorp/packer
scripts/generate-plugins.go
discoverTypesInPath
func discoverTypesInPath(path, typeID string) ([]plugin, error) { postProcessors := []plugin{} dirs, err := listDirectories(path) if err != nil { return postProcessors, err } for _, dir := range dirs { fset := token.NewFileSet() goPackages, err := parser.ParseDir(fset, dir, nil, parser.AllErrors) if err ...
go
func discoverTypesInPath(path, typeID string) ([]plugin, error) { postProcessors := []plugin{} dirs, err := listDirectories(path) if err != nil { return postProcessors, err } for _, dir := range dirs { fset := token.NewFileSet() goPackages, err := parser.ParseDir(fset, dir, nil, parser.AllErrors) if err ...
[ "func", "discoverTypesInPath", "(", "path", ",", "typeID", "string", ")", "(", "[", "]", "plugin", ",", "error", ")", "{", "postProcessors", ":=", "[", "]", "plugin", "{", "}", "\n\n", "dirs", ",", "err", ":=", "listDirectories", "(", "path", ")", "\n"...
// discoverTypesInPath searches for types of typeID in path and returns a list // of plugins it finds.
[ "discoverTypesInPath", "searches", "for", "types", "of", "typeID", "in", "path", "and", "returns", "a", "list", "of", "plugins", "it", "finds", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/scripts/generate-plugins.go#L166-L209
165,074
hashicorp/packer
helper/communicator/config.go
ReadSSHPrivateKeyFile
func (c *Config) ReadSSHPrivateKeyFile() ([]byte, error) { var privateKey []byte if c.SSHPrivateKeyFile != "" { keyPath, err := packer.ExpandUser(c.SSHPrivateKeyFile) if err != nil { return []byte{}, fmt.Errorf("Error expanding path for SSH private key: %s", err) } privateKey, err = ioutil.ReadFile(keyPa...
go
func (c *Config) ReadSSHPrivateKeyFile() ([]byte, error) { var privateKey []byte if c.SSHPrivateKeyFile != "" { keyPath, err := packer.ExpandUser(c.SSHPrivateKeyFile) if err != nil { return []byte{}, fmt.Errorf("Error expanding path for SSH private key: %s", err) } privateKey, err = ioutil.ReadFile(keyPa...
[ "func", "(", "c", "*", "Config", ")", "ReadSSHPrivateKeyFile", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "privateKey", "[", "]", "byte", "\n\n", "if", "c", ".", "SSHPrivateKeyFile", "!=", "\"", "\"", "{", "keyPath", ",", "err", ...
// ReadSSHPrivateKeyFile returns the SSH private key bytes
[ "ReadSSHPrivateKeyFile", "returns", "the", "SSH", "private", "key", "bytes" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L75-L90
165,075
hashicorp/packer
helper/communicator/config.go
SSHConfigFunc
func (c *Config) SSHConfigFunc() func(multistep.StateBag) (*ssh.ClientConfig, error) { return func(state multistep.StateBag) (*ssh.ClientConfig, error) { sshConfig := &ssh.ClientConfig{ User: c.SSHUsername, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } if c.SSHAgentAuth { authSock := os.Ge...
go
func (c *Config) SSHConfigFunc() func(multistep.StateBag) (*ssh.ClientConfig, error) { return func(state multistep.StateBag) (*ssh.ClientConfig, error) { sshConfig := &ssh.ClientConfig{ User: c.SSHUsername, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } if c.SSHAgentAuth { authSock := os.Ge...
[ "func", "(", "c", "*", "Config", ")", "SSHConfigFunc", "(", ")", "func", "(", "multistep", ".", "StateBag", ")", "(", "*", "ssh", ".", "ClientConfig", ",", "error", ")", "{", "return", "func", "(", "state", "multistep", ".", "StateBag", ")", "(", "*"...
// 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.
[ "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", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L95-L150
165,076
hashicorp/packer
helper/communicator/config.go
Port
func (c *Config) Port() int { switch c.Type { case "ssh": return c.SSHPort case "winrm": return c.WinRMPort default: return 0 } }
go
func (c *Config) Port() int { switch c.Type { case "ssh": return c.SSHPort case "winrm": return c.WinRMPort default: return 0 } }
[ "func", "(", "c", "*", "Config", ")", "Port", "(", ")", "int", "{", "switch", "c", ".", "Type", "{", "case", "\"", "\"", ":", "return", "c", ".", "SSHPort", "\n", "case", "\"", "\"", ":", "return", "c", ".", "WinRMPort", "\n", "default", ":", "...
// Port returns the port that will be used for access based on config.
[ "Port", "returns", "the", "port", "that", "will", "be", "used", "for", "access", "based", "on", "config", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L153-L162
165,077
hashicorp/packer
helper/communicator/config.go
Host
func (c *Config) Host() string { switch c.Type { case "ssh": return c.SSHHost case "winrm": return c.WinRMHost default: return "" } }
go
func (c *Config) Host() string { switch c.Type { case "ssh": return c.SSHHost case "winrm": return c.WinRMHost default: return "" } }
[ "func", "(", "c", "*", "Config", ")", "Host", "(", ")", "string", "{", "switch", "c", ".", "Type", "{", "case", "\"", "\"", ":", "return", "c", ".", "SSHHost", "\n", "case", "\"", "\"", ":", "return", "c", ".", "WinRMHost", "\n", "default", ":", ...
// Host returns the port that will be used for access based on config.
[ "Host", "returns", "the", "port", "that", "will", "be", "used", "for", "access", "based", "on", "config", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L165-L174
165,078
hashicorp/packer
helper/communicator/config.go
User
func (c *Config) User() string { switch c.Type { case "ssh": return c.SSHUsername case "winrm": return c.WinRMUser default: return "" } }
go
func (c *Config) User() string { switch c.Type { case "ssh": return c.SSHUsername case "winrm": return c.WinRMUser default: return "" } }
[ "func", "(", "c", "*", "Config", ")", "User", "(", ")", "string", "{", "switch", "c", ".", "Type", "{", "case", "\"", "\"", ":", "return", "c", ".", "SSHUsername", "\n", "case", "\"", "\"", ":", "return", "c", ".", "WinRMUser", "\n", "default", "...
// User returns the port that will be used for access based on config.
[ "User", "returns", "the", "port", "that", "will", "be", "used", "for", "access", "based", "on", "config", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L177-L186
165,079
hashicorp/packer
helper/communicator/config.go
Password
func (c *Config) Password() string { switch c.Type { case "ssh": return c.SSHPassword case "winrm": return c.WinRMPassword default: return "" } }
go
func (c *Config) Password() string { switch c.Type { case "ssh": return c.SSHPassword case "winrm": return c.WinRMPassword default: return "" } }
[ "func", "(", "c", "*", "Config", ")", "Password", "(", ")", "string", "{", "switch", "c", ".", "Type", "{", "case", "\"", "\"", ":", "return", "c", ".", "SSHPassword", "\n", "case", "\"", "\"", ":", "return", "c", ".", "WinRMPassword", "\n", "defau...
// Password returns the port that will be used for access based on config.
[ "Password", "returns", "the", "port", "that", "will", "be", "used", "for", "access", "based", "on", "config", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/communicator/config.go#L189-L198
165,080
hashicorp/packer
common/bootcommand/boot_command_ast.go
Do
func (s expressionSequence) Do(ctx context.Context, b BCDriver) error { // validate should never fail here, since it should be called before // expressionSequence.Do. Only reason we don't panic is so we can clean up. if errs := s.Validate(); errs != nil { return fmt.Errorf("Found an invalid boot command. This is l...
go
func (s expressionSequence) Do(ctx context.Context, b BCDriver) error { // validate should never fail here, since it should be called before // expressionSequence.Do. Only reason we don't panic is so we can clean up. if errs := s.Validate(); errs != nil { return fmt.Errorf("Found an invalid boot command. This is l...
[ "func", "(", "s", "expressionSequence", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "b", "BCDriver", ")", "error", "{", "// validate should never fail here, since it should be called before", "// expressionSequence.Do. Only reason we don't panic is so we can clean up."...
// Do executes every expression in the sequence and then flushes remaining // scancodes.
[ "Do", "executes", "every", "expression", "in", "the", "sequence", "and", "then", "flushes", "remaining", "scancodes", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L47-L63
165,081
hashicorp/packer
common/bootcommand/boot_command_ast.go
Validate
func (s expressionSequence) Validate() (errs []error) { for _, exp := range s { if err := exp.Validate(); err != nil { errs = append(errs, err) } } return }
go
func (s expressionSequence) Validate() (errs []error) { for _, exp := range s { if err := exp.Validate(); err != nil { errs = append(errs, err) } } return }
[ "func", "(", "s", "expressionSequence", ")", "Validate", "(", ")", "(", "errs", "[", "]", "error", ")", "{", "for", "_", ",", "exp", ":=", "range", "s", "{", "if", "err", ":=", "exp", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "er...
// Validate tells us if every expression in the sequence is valid.
[ "Validate", "tells", "us", "if", "every", "expression", "in", "the", "sequence", "is", "valid", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L66-L73
165,082
hashicorp/packer
common/bootcommand/boot_command_ast.go
GenerateExpressionSequence
func GenerateExpressionSequence(command string) (expressionSequence, error) { seq := expressionSequence{} if command == "" { return seq, nil } got, err := ParseReader("", strings.NewReader(command)) if err != nil { return nil, err } for _, exp := range got.([]interface{}) { seq = append(seq, exp.(expressio...
go
func GenerateExpressionSequence(command string) (expressionSequence, error) { seq := expressionSequence{} if command == "" { return seq, nil } got, err := ParseReader("", strings.NewReader(command)) if err != nil { return nil, err } for _, exp := range got.([]interface{}) { seq = append(seq, exp.(expressio...
[ "func", "GenerateExpressionSequence", "(", "command", "string", ")", "(", "expressionSequence", ",", "error", ")", "{", "seq", ":=", "expressionSequence", "{", "}", "\n", "if", "command", "==", "\"", "\"", "{", "return", "seq", ",", "nil", "\n", "}", "\n",...
// GenerateExpressionSequence generates a sequence of expressions from the // given command. This is the primary entry point to the boot command parser.
[ "GenerateExpressionSequence", "generates", "a", "sequence", "of", "expressions", "from", "the", "given", "command", ".", "This", "is", "the", "primary", "entry", "point", "to", "the", "boot", "command", "parser", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L77-L90
165,083
hashicorp/packer
common/bootcommand/boot_command_ast.go
Do
func (w *waitExpression) Do(ctx context.Context, driver BCDriver) error { driver.Flush() log.Printf("[INFO] Waiting %s", w.d) select { case <-time.After(w.d): return nil case <-ctx.Done(): return ctx.Err() } }
go
func (w *waitExpression) Do(ctx context.Context, driver BCDriver) error { driver.Flush() log.Printf("[INFO] Waiting %s", w.d) select { case <-time.After(w.d): return nil case <-ctx.Done(): return ctx.Err() } }
[ "func", "(", "w", "*", "waitExpression", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "driver", "BCDriver", ")", "error", "{", "driver", ".", "Flush", "(", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "w", ".", "d", ")", "\n",...
// Do waits the amount of time described by the expression. It is cancellable // through the context.
[ "Do", "waits", "the", "amount", "of", "time", "described", "by", "the", "expression", ".", "It", "is", "cancellable", "through", "the", "context", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L98-L107
165,084
hashicorp/packer
common/bootcommand/boot_command_ast.go
Validate
func (w *waitExpression) Validate() error { if w.d <= 0 { return fmt.Errorf("Expecting a positive wait value. Got %s", w.d) } return nil }
go
func (w *waitExpression) Validate() error { if w.d <= 0 { return fmt.Errorf("Expecting a positive wait value. Got %s", w.d) } return nil }
[ "func", "(", "w", "*", "waitExpression", ")", "Validate", "(", ")", "error", "{", "if", "w", ".", "d", "<=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "w", ".", "d", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Validate returns an error if the time is <= 0
[ "Validate", "returns", "an", "error", "if", "the", "time", "is", "<", "=", "0" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L110-L115
165,085
hashicorp/packer
common/bootcommand/boot_command_ast.go
Do
func (s *specialExpression) Do(ctx context.Context, driver BCDriver) error { return driver.SendSpecial(s.s, s.action) }
go
func (s *specialExpression) Do(ctx context.Context, driver BCDriver) error { return driver.SendSpecial(s.s, s.action) }
[ "func", "(", "s", "*", "specialExpression", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "driver", "BCDriver", ")", "error", "{", "return", "driver", ".", "SendSpecial", "(", "s", ".", "s", ",", "s", ".", "action", ")", "\n", "}" ]
// Do sends the special command to the driver, along with the key action.
[ "Do", "sends", "the", "special", "command", "to", "the", "driver", "along", "with", "the", "key", "action", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L127-L129
165,086
hashicorp/packer
common/bootcommand/boot_command_ast.go
Do
func (l *literal) Do(ctx context.Context, driver BCDriver) error { return driver.SendKey(l.s, l.action) }
go
func (l *literal) Do(ctx context.Context, driver BCDriver) error { return driver.SendKey(l.s, l.action) }
[ "func", "(", "l", "*", "literal", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "driver", "BCDriver", ")", "error", "{", "return", "driver", ".", "SendKey", "(", "l", ".", "s", ",", "l", ".", "action", ")", "\n", "}" ]
// Do sends the key to the driver, along with the key action.
[ "Do", "sends", "the", "key", "to", "the", "driver", "along", "with", "the", "key", "action", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/boot_command_ast.go#L146-L148
165,087
hashicorp/packer
builder/parallels/common/shutdown_config.go
Prepare
func (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error { if c.RawShutdownTimeout == "" { c.RawShutdownTimeout = "5m" } var errs []error var err error c.ShutdownTimeout, err = time.ParseDuration(c.RawShutdownTimeout) if err != nil { errs = append(errs, fmt.Errorf("Failed parsing shutdown_timeout: ...
go
func (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error { if c.RawShutdownTimeout == "" { c.RawShutdownTimeout = "5m" } var errs []error var err error c.ShutdownTimeout, err = time.ParseDuration(c.RawShutdownTimeout) if err != nil { errs = append(errs, fmt.Errorf("Failed parsing shutdown_timeout: ...
[ "func", "(", "c", "*", "ShutdownConfig", ")", "Prepare", "(", "ctx", "*", "interpolate", ".", "Context", ")", "[", "]", "error", "{", "if", "c", ".", "RawShutdownTimeout", "==", "\"", "\"", "{", "c", ".", "RawShutdownTimeout", "=", "\"", "\"", "\n", ...
// Prepare sets default values to the VM shutdown configuration.
[ "Prepare", "sets", "default", "values", "to", "the", "VM", "shutdown", "configuration", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/shutdown_config.go#L19-L32
165,088
hashicorp/packer
builder/hyperv/common/step_collate_artifacts.go
Run
func (s *StepCollateArtifacts) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Collating build artifacts...") if s.SkipExport { // Get the path to the main build directory from the statebag var buildDir ...
go
func (s *StepCollateArtifacts) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Collating build artifacts...") if s.SkipExport { // Get the path to the main build directory from the statebag var buildDir ...
[ "func", "(", "s", "*", "StepCollateArtifacts", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "driver", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(",...
// Runs the step required to collate all build artifacts under the // specified output directory
[ "Runs", "the", "step", "required", "to", "collate", "all", "build", "artifacts", "under", "the", "specified", "output", "directory" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/hyperv/common/step_collate_artifacts.go#L18-L66
165,089
hashicorp/packer
packer/rpc/server.go
NewServer
func NewServer(conn io.ReadWriteCloser) (*Server, error) { mux, err := newMuxBrokerServer(conn) if err != nil { return nil, err } result := newServerWithMux(mux, 0) result.closeMux = true go mux.Run() return result, nil }
go
func NewServer(conn io.ReadWriteCloser) (*Server, error) { mux, err := newMuxBrokerServer(conn) if err != nil { return nil, err } result := newServerWithMux(mux, 0) result.closeMux = true go mux.Run() return result, nil }
[ "func", "NewServer", "(", "conn", "io", ".", "ReadWriteCloser", ")", "(", "*", "Server", ",", "error", ")", "{", "mux", ",", "err", ":=", "newMuxBrokerServer", "(", "conn", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", ...
// NewServer returns a new Packer RPC server.
[ "NewServer", "returns", "a", "new", "Packer", "RPC", "server", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/rpc/server.go#L35-L44
165,090
hashicorp/packer
packer/rpc/server.go
Serve
func (s *Server) Serve() { // Accept a connection on stream ID 0, which is always used for // normal client to server connections. stream, err := s.mux.Accept(s.streamId) if err != nil { log.Printf("[ERR] Error retrieving stream for serving: %s", err) return } defer stream.Close() h := &codec.MsgpackHandle{...
go
func (s *Server) Serve() { // Accept a connection on stream ID 0, which is always used for // normal client to server connections. stream, err := s.mux.Accept(s.streamId) if err != nil { log.Printf("[ERR] Error retrieving stream for serving: %s", err) return } defer stream.Close() h := &codec.MsgpackHandle{...
[ "func", "(", "s", "*", "Server", ")", "Serve", "(", ")", "{", "// Accept a connection on stream ID 0, which is always used for", "// normal client to server connections.", "stream", ",", "err", ":=", "s", ".", "mux", ".", "Accept", "(", "s", ".", "streamId", ")", ...
// ServeConn serves a single connection over the RPC server. It is up // to the caller to obtain a proper io.ReadWriteCloser.
[ "ServeConn", "serves", "a", "single", "connection", "over", "the", "RPC", "server", ".", "It", "is", "up", "to", "the", "caller", "to", "obtain", "a", "proper", "io", ".", "ReadWriteCloser", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/packer/rpc/server.go#L121-L137
165,091
hashicorp/packer
fix/helpers.go
ppList
func (pp *PP) ppList() []map[string]interface{} { pps := make([]map[string]interface{}, 0, len(pp.PostProcessors)) for _, rawPP := range pp.PostProcessors { switch pp := rawPP.(type) { case string: case map[string]interface{}: pps = append(pps, pp) case []interface{}: for _, innerRawPP := range pp { ...
go
func (pp *PP) ppList() []map[string]interface{} { pps := make([]map[string]interface{}, 0, len(pp.PostProcessors)) for _, rawPP := range pp.PostProcessors { switch pp := rawPP.(type) { case string: case map[string]interface{}: pps = append(pps, pp) case []interface{}: for _, innerRawPP := range pp { ...
[ "func", "(", "pp", "*", "PP", ")", "ppList", "(", ")", "[", "]", "map", "[", "string", "]", "interface", "{", "}", "{", "pps", ":=", "make", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ",", "0", ",", "len", "(", "pp", "...
// postProcessors converts the variable structure of the template to a list
[ "postProcessors", "converts", "the", "variable", "structure", "of", "the", "template", "to", "a", "list" ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/fix/helpers.go#L9-L25
165,092
hashicorp/packer
builder/parallels/common/step_attach_floppy.go
Run
func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // Determine if we even have a floppy disk to attach var floppyPath string if floppyPathRaw, ok := state.GetOk("floppy_path"); ok { floppyPath = floppyPathRaw.(string) } else { log.Println("No floppy disk, not a...
go
func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // Determine if we even have a floppy disk to attach var floppyPath string if floppyPathRaw, ok := state.GetOk("floppy_path"); ok { floppyPath = floppyPathRaw.(string) } else { log.Println("No floppy disk, not a...
[ "func", "(", "s", "*", "StepAttachFloppy", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "state", "multistep", ".", "StateBag", ")", "multistep", ".", "StepAction", "{", "// Determine if we even have a floppy disk to attach", "var", "floppyPath", "string",...
// Run adds a virtual FDD device to the VM and attaches the image. // If the image is not specified, then this step will be skipped.
[ "Run", "adds", "a", "virtual", "FDD", "device", "to", "the", "VM", "and", "attaches", "the", "image", ".", "If", "the", "image", "is", "not", "specified", "then", "this", "step", "will", "be", "skipped", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/step_attach_floppy.go#L26-L66
165,093
hashicorp/packer
builder/parallels/common/step_attach_floppy.go
Cleanup
func (s *StepAttachFloppy) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) if s.floppyPath == "" { return } log.Println("Detaching floppy disk...") command := []string{ "set", vmName, "--device-del", "fdd0", } driver.Prlctl(command...) }
go
func (s *StepAttachFloppy) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) if s.floppyPath == "" { return } log.Println("Detaching floppy disk...") command := []string{ "set", vmName, "--device-del", "fdd0", } driver.Prlctl(command...) }
[ "func", "(", "s", "*", "StepAttachFloppy", ")", "Cleanup", "(", "state", "multistep", ".", "StateBag", ")", "{", "driver", ":=", "state", ".", "Get", "(", "\"", "\"", ")", ".", "(", "Driver", ")", "\n", "vmName", ":=", "state", ".", "Get", "(", "\"...
// Cleanup removes the virtual FDD device attached to the VM.
[ "Cleanup", "removes", "the", "virtual", "FDD", "device", "attached", "to", "the", "VM", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/builder/parallels/common/step_attach_floppy.go#L69-L83
165,094
hashicorp/packer
common/bootcommand/pc_xt_driver.go
Flush
func (d *pcXTDriver) Flush() error { defer func() { d.buffer = nil }() sc, err := chunkScanCodes(d.buffer, d.scancodeChunkSize) if err != nil { return err } for _, b := range sc { if err := d.sendImpl(b); err != nil { return err } time.Sleep(d.interval) } return nil }
go
func (d *pcXTDriver) Flush() error { defer func() { d.buffer = nil }() sc, err := chunkScanCodes(d.buffer, d.scancodeChunkSize) if err != nil { return err } for _, b := range sc { if err := d.sendImpl(b); err != nil { return err } time.Sleep(d.interval) } return nil }
[ "func", "(", "d", "*", "pcXTDriver", ")", "Flush", "(", ")", "error", "{", "defer", "func", "(", ")", "{", "d", ".", "buffer", "=", "nil", "\n", "}", "(", ")", "\n", "sc", ",", "err", ":=", "chunkScanCodes", "(", "d", ".", "buffer", ",", "d", ...
// Flush send all scanecodes.
[ "Flush", "send", "all", "scanecodes", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/pc_xt_driver.go#L129-L144
165,095
hashicorp/packer
common/bootcommand/pc_xt_driver.go
send
func (d *pcXTDriver) send(codes []string) { d.buffer = append(d.buffer, codes) }
go
func (d *pcXTDriver) send(codes []string) { d.buffer = append(d.buffer, codes) }
[ "func", "(", "d", "*", "pcXTDriver", ")", "send", "(", "codes", "[", "]", "string", ")", "{", "d", ".", "buffer", "=", "append", "(", "d", ".", "buffer", ",", "codes", ")", "\n", "}" ]
// send stores the codes in an internal buffer. Use Flush to send them.
[ "send", "stores", "the", "codes", "in", "an", "internal", "buffer", ".", "Use", "Flush", "to", "send", "them", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/common/bootcommand/pc_xt_driver.go#L193-L195
165,096
hashicorp/packer
helper/ssh/key_pair.go
NewKeyPair
func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error) { if config.Type == Default { config.Type = Ecdsa } switch config.Type { case Ecdsa: return newEcdsaKeyPair(config) case Rsa: return newRsaKeyPair(config) } return KeyPair{}, fmt.Errorf("Unable to generate new key pair, type %s is not supported...
go
func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error) { if config.Type == Default { config.Type = Ecdsa } switch config.Type { case Ecdsa: return newEcdsaKeyPair(config) case Rsa: return newRsaKeyPair(config) } return KeyPair{}, fmt.Errorf("Unable to generate new key pair, type %s is not supported...
[ "func", "NewKeyPair", "(", "config", "CreateKeyPairConfig", ")", "(", "KeyPair", ",", "error", ")", "{", "if", "config", ".", "Type", "==", "Default", "{", "config", ".", "Type", "=", "Ecdsa", "\n", "}", "\n\n", "switch", "config", ".", "Type", "{", "c...
// NewKeyPair generates a new SSH key pair using the specified // CreateKeyPairConfig.
[ "NewKeyPair", "generates", "a", "new", "SSH", "key", "pair", "using", "the", "specified", "CreateKeyPairConfig", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/ssh/key_pair.go#L112-L126
165,097
hashicorp/packer
helper/ssh/key_pair.go
newEcdsaKeyPair
func newEcdsaKeyPair(config CreateKeyPairConfig) (KeyPair, error) { var curve elliptic.Curve switch config.Bits { case 0: config.Bits = 521 fallthrough case 521: curve = elliptic.P521() case 384: curve = elliptic.P384() case 256: curve = elliptic.P256() case 224: // Not supported by "golang.org/x/cr...
go
func newEcdsaKeyPair(config CreateKeyPairConfig) (KeyPair, error) { var curve elliptic.Curve switch config.Bits { case 0: config.Bits = 521 fallthrough case 521: curve = elliptic.P521() case 384: curve = elliptic.P384() case 256: curve = elliptic.P256() case 224: // Not supported by "golang.org/x/cr...
[ "func", "newEcdsaKeyPair", "(", "config", "CreateKeyPairConfig", ")", "(", "KeyPair", ",", "error", ")", "{", "var", "curve", "elliptic", ".", "Curve", "\n\n", "switch", "config", ".", "Bits", "{", "case", "0", ":", "config", ".", "Bits", "=", "521", "\n...
// newEcdsaKeyPair returns a new ECDSA SSH key pair.
[ "newEcdsaKeyPair", "returns", "a", "new", "ECDSA", "SSH", "key", "pair", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/ssh/key_pair.go#L129-L178
165,098
hashicorp/packer
helper/ssh/key_pair.go
newRsaKeyPair
func newRsaKeyPair(config CreateKeyPairConfig) (KeyPair, error) { if config.Bits == 0 { config.Bits = defaultRsaBits } privateKey, err := rsa.GenerateKey(rand.Reader, config.Bits) if err != nil { return KeyPair{}, err } sshPublicKey, err := gossh.NewPublicKey(&privateKey.PublicKey) if err != nil { return...
go
func newRsaKeyPair(config CreateKeyPairConfig) (KeyPair, error) { if config.Bits == 0 { config.Bits = defaultRsaBits } privateKey, err := rsa.GenerateKey(rand.Reader, config.Bits) if err != nil { return KeyPair{}, err } sshPublicKey, err := gossh.NewPublicKey(&privateKey.PublicKey) if err != nil { return...
[ "func", "newRsaKeyPair", "(", "config", "CreateKeyPairConfig", ")", "(", "KeyPair", ",", "error", ")", "{", "if", "config", ".", "Bits", "==", "0", "{", "config", ".", "Bits", "=", "defaultRsaBits", "\n", "}", "\n\n", "privateKey", ",", "err", ":=", "rsa...
// newRsaKeyPair returns a new RSA SSH key pair.
[ "newRsaKeyPair", "returns", "a", "new", "RSA", "SSH", "key", "pair", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/ssh/key_pair.go#L181-L210
165,099
hashicorp/packer
helper/ssh/key_pair.go
rawPemBlock
func rawPemBlock(block *pem.Block) ([]byte, error) { buffer := bytes.NewBuffer(nil) err := pem.Encode(buffer, block) if err != nil { return []byte{}, err } return buffer.Bytes(), nil }
go
func rawPemBlock(block *pem.Block) ([]byte, error) { buffer := bytes.NewBuffer(nil) err := pem.Encode(buffer, block) if err != nil { return []byte{}, err } return buffer.Bytes(), nil }
[ "func", "rawPemBlock", "(", "block", "*", "pem", ".", "Block", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buffer", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n\n", "err", ":=", "pem", ".", "Encode", "(", "buffer", ",", "block", ...
// rawPemBlock encodes a pem.Block to a slice of bytes.
[ "rawPemBlock", "encodes", "a", "pem", ".", "Block", "to", "a", "slice", "of", "bytes", "." ]
d343852c15da050ee3ad039cc4cadfbf7f9b1759
https://github.com/hashicorp/packer/blob/d343852c15da050ee3ad039cc4cadfbf7f9b1759/helper/ssh/key_pair.go#L229-L238