Skip to content

Commit

Permalink
chore: update grammar
Browse files Browse the repository at this point in the history
Updates grammar in comments and documentation, as needed.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed Dec 5, 2024
1 parent df729d0 commit 41d3145
Show file tree
Hide file tree
Showing 27 changed files with 173 additions and 178 deletions.
28 changes: 15 additions & 13 deletions .web-docs/components/builder/iso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ JSON Example:

- `sound` (bool) - Enable virtual sound card device. Defaults to `false`.

- `usb` (bool) - Enable a the USB 2.0 controllers for the virtual machine.
- `usb` (bool) - Enable USB 2.0 controllers for the virtual machine.
Defaults to `false`.

~> **Note:** To enable USB 3.0 controllers, set a `usb_xhci.present`
Expand Down Expand Up @@ -174,7 +174,7 @@ JSON Example:
the virtual machine should yield the CPU when polling the port. By
default, the builder will assume this as `FALSE`.

* `AUTO:(yield)` - Specifies to use auto-detection to determine the
* `AUTO: (yield)` - Specifies to use auto-detection to determine the
serial port to use. This has one option to determine how the virtual
machine should support the serial port.

Expand Down Expand Up @@ -278,15 +278,15 @@ JSON Example:

<!-- Code generated from the comments of the ToolsConfig struct in builder/vmware/common/tools_config.go; DO NOT EDIT MANUALLY -->

- `tools_upload_flavor` (string) - The flavor of VMware tools to upload into the virtual machine based on
- `tools_upload_flavor` (string) - The flavor of VMware Tools to upload into the virtual machine based on
the guest operating system. Allowed values are `darwin` (macOS), `linux`,
and `windows`. Default is empty and no version will be uploaded.

- `tools_upload_path` (string) - The path in the VM to upload the VMware tools. This only takes effect if
`tools_upload_flavor` is non-empty. This is a [configuration
template](/packer/docs/templates/legacy_json_templates/engine) that has a
single valid variable: `Flavor`, which will be the value of
`tools_upload_flavor`. By default the upload path is set to
`tools_upload_flavor`. By default, the upload path is set to
`{{.Flavor}}.iso`.

~> **Note:** This setting is not used when `remote_type` is `esxi`.
Expand Down Expand Up @@ -687,24 +687,26 @@ wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg
This may be relative or absolute. If relative, the path is relative to
the working directory when packer is executed.

If you are running a remote hypervisor build, the output_dir is the path on your
local machine (the machine running Packer) to which Packer will export
the vm if you have `"skip_export": false`. If you want to manage the
virtual machine's path on the remote datastore, use `remote_output_dir`.
If you are running a remote hypervisor build, the `output_dir` is the
path on your local machine (the machine running Packer) to which
Packer will export the virtual machine if you have
`"skip_export": false`. If you want to manage the virtual machine's
path on the remote datastore, use `remote_output_dir`.

This directory must not exist or be empty prior to running
the builder.

By default this is output-BUILDNAME where "BUILDNAME" is the name of the
build.
By default, this is `output-BUILDNAME` where `BUILDNAME` is the name of
the build.

- `remote_output_directory` (string) - This is the directory on your remote hypervisor where you will save your
vm, relative to your remote_datastore.
virtual machine, relative to your remote_datastore.

This option's default value is your `vm_name`, and the final path of your
vm will be vmfs/volumes/$remote_datastore/$vm_name/$vm_name.vmx where
virtual machine will be
`vmfs/volumes/$remote_datastore/$vm_name/$vm_name.vmx` where
`$remote_datastore` and `$vm_name` match their corresponding template
options
options.

For example, setting `"remote_output_directory": "path/to/subdir`
will create a directory `/vmfs/volumes/remote_datastore/path/to/subdir`.
Expand Down
60 changes: 31 additions & 29 deletions .web-docs/components/builder/vmx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ JSON Example:

<!-- Code generated from the comments of the Config struct in builder/vmware/vmx/config.go; DO NOT EDIT MANUALLY -->

- `source_path` (string) - Path to the source VMX file to clone. If
remote_type is enabled then this specifies a path on the remote_host.
- `source_path` (string) - Path to the source `.vmx` file to clone. If `remote_type` is enabled
then this specifies a path on the `remote_host`.

<!-- End of code generated from the comments of the Config struct in builder/vmware/vmx/config.go; -->

Expand All @@ -63,31 +63,31 @@ JSON Example:

<!-- Code generated from the comments of the Config struct in builder/vmware/vmx/config.go; DO NOT EDIT MANUALLY -->

- `linked` (bool) - By default Packer creates a 'full' clone of the virtual machine
specified in source_path. The resultant virtual machine is fully
independent from the parent it was cloned from.
- `linked` (bool) - By default, the plugin creates a 'full' clone of the virtual machine
specified in `source_path`. The resultant virtual machine is fully
independent of the parent it was cloned from.

Setting linked to true instead causes Packer to create the virtual
machine as a 'linked' clone. Linked clones use and require ongoing
Setting linked to true instead causes the plugin to create the virtual
machine as a linked clone. Linked clones use and require ongoing
access to the disks of the parent virtual machine. The benefit of a
linked clone is that the clones virtual disk is typically very much
smaller than would be the case for a full clone. Additionally, the
cloned virtual machine can also be created much faster. Creating a
linked clone will typically only be of benefit in some advanced build
scenarios. Most users will wish to create a full clone instead. Defaults
to false.
scenarios. Most users will wish to create a full clone instead.
Defaults to `false`.

- `attach_snapshot` (string) - Default to `null/empty`. The name of an
**existing** snapshot to which the builder shall attach the VM before
starting it. If no snapshot is specified the builder will simply start the
VM from it's current state i.e. snapshot.
- `attach_snapshot` (string) - The name of an existing snapshot to which the builder shall attach the
virtual machine before powering on. If no snapshot is specified the
virtual machine is started from its current state. Default to
`null/empty`.

- `vm_name` (string) - This is the name of the VMX file for the new virtual
machine, without the file extension. By default this is packer-BUILDNAME,
where "BUILDNAME" is the name of the build.
- `vm_name` (string) - This is the name of the `.vmx` file for the virtual machine, without
the file extension. By default, this is `packer-BUILDNAME`, where
`BUILDNAME` is the name of the build.

- `snapshot_name` (string) - This is the name of the initial snapshot created after provisioning and cleanup.
if left blank, no initial snapshot will be created
- `snapshot_name` (string) - This is the name of the initial snapshot created after provisioning and
cleanup. If blank, no snapshot is created.

<!-- End of code generated from the comments of the Config struct in builder/vmware/vmx/config.go; -->

Expand Down Expand Up @@ -148,15 +148,15 @@ JSON Example:

<!-- Code generated from the comments of the ToolsConfig struct in builder/vmware/common/tools_config.go; DO NOT EDIT MANUALLY -->

- `tools_upload_flavor` (string) - The flavor of VMware tools to upload into the virtual machine based on
- `tools_upload_flavor` (string) - The flavor of VMware Tools to upload into the virtual machine based on
the guest operating system. Allowed values are `darwin` (macOS), `linux`,
and `windows`. Default is empty and no version will be uploaded.

- `tools_upload_path` (string) - The path in the VM to upload the VMware tools. This only takes effect if
`tools_upload_flavor` is non-empty. This is a [configuration
template](/packer/docs/templates/legacy_json_templates/engine) that has a
single valid variable: `Flavor`, which will be the value of
`tools_upload_flavor`. By default the upload path is set to
`tools_upload_flavor`. By default, the upload path is set to
`{{.Flavor}}.iso`.

~> **Note:** This setting is not used when `remote_type` is `esxi`.
Expand Down Expand Up @@ -459,24 +459,26 @@ wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg
This may be relative or absolute. If relative, the path is relative to
the working directory when packer is executed.

If you are running a remote hypervisor build, the output_dir is the path on your
local machine (the machine running Packer) to which Packer will export
the vm if you have `"skip_export": false`. If you want to manage the
virtual machine's path on the remote datastore, use `remote_output_dir`.
If you are running a remote hypervisor build, the `output_dir` is the
path on your local machine (the machine running Packer) to which
Packer will export the virtual machine if you have
`"skip_export": false`. If you want to manage the virtual machine's
path on the remote datastore, use `remote_output_dir`.

This directory must not exist or be empty prior to running
the builder.

By default this is output-BUILDNAME where "BUILDNAME" is the name of the
build.
By default, this is `output-BUILDNAME` where `BUILDNAME` is the name of
the build.

- `remote_output_directory` (string) - This is the directory on your remote hypervisor where you will save your
vm, relative to your remote_datastore.
virtual machine, relative to your remote_datastore.

This option's default value is your `vm_name`, and the final path of your
vm will be vmfs/volumes/$remote_datastore/$vm_name/$vm_name.vmx where
virtual machine will be
`vmfs/volumes/$remote_datastore/$vm_name/$vm_name.vmx` where
`$remote_datastore` and `$vm_name` match their corresponding template
options
options.

For example, setting `"remote_output_directory": "path/to/subdir`
will create a directory `/vmfs/volumes/remote_datastore/path/to/subdir`.
Expand Down
11 changes: 5 additions & 6 deletions builder/vmware/common/driver_esxi.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (d *EsxiDriver) HostAddress(multistep.StateBag) (string, error) {
}
}

// ..unfortunately nothing was found
// If an interface is not found, return an error.
return "", fmt.Errorf("error locating an interface matching host address: %v", host)
}

Expand Down Expand Up @@ -495,22 +495,21 @@ func (d *EsxiDriver) GuestAddress(multistep.StateBag) (string, error) {
return "", fmt.Errorf("error matching address for guest")
}

// find the MAC address according to the interface name
// Find the MAC address for the interface.
result, ok := addrs[intf]
if !ok {
return "", fmt.Errorf("error finding MAC address for interface %s", intf)
}

// ..and we're good
return result, nil
}

func (d *EsxiDriver) VNCAddress(ctx context.Context, _ string, portMin, portMax int) (string, int, error) {
var vncPort int

// Process ports ESXi is listening on to determine which are available.
// This process uses best effort to detect which are unavailable and will
// iignore any ports listened to by only localhost.
// This process detects which are unavailable ignore any ports listened to
// by only localhost.
r, err := d.esxcli("network", "ip", "connection", "list")
if err != nil {
err = fmt.Errorf("error retrieving network information for host: %v", err)
Expand Down Expand Up @@ -806,7 +805,7 @@ func (d *EsxiDriver) mkdir(path string) error {
}

func (d *EsxiDriver) upload(dst, src string, ui packersdk.Ui) error {
// Get the size to setup the progress tracker.
// Get the size to set up the progress tracker.
info, err := os.Stat(src)
if err != nil {
return err
Expand Down
46 changes: 23 additions & 23 deletions builder/vmware/common/driver_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func parseDhcpConfig(in chan string) (tkGroup, error) {

case ";":
// If we encounter a line-terminator, then the list of tokens we've been
// aggregating are ready to be parsed. Afterwards, we can write them
// aggregating are ready to be parsed. Afterward, we can write them
// to our current tree node.

arg := toParameter(tokens)
Expand Down Expand Up @@ -357,7 +357,7 @@ func tokenizeNetworkMapConfig(in chan byte) chan string {
state += string(by)
}

// If we made it here, then we can guarantee that the we didn't just
// If we made it here, then we can guarantee that we didn't just
// process a newline. Clear this flag for the next one we find.
lastnewline = false
}
Expand Down Expand Up @@ -442,7 +442,7 @@ func parseNetworkMapConfig(in chan string) (NetworkMap, error) {
}
}

// Go through our unsorted map, and collect all of the keys for "network".
// Go through our unsorted map, and collect all the keys for "network".
result := make([]map[string]string, 0)
var keys []string
for k := range unsorted {
Expand All @@ -461,7 +461,7 @@ func parseNetworkMapConfig(in chan string) (NetworkMap, error) {
}

/** higher-level parsing */
/// parameters
// parameters
type pParameter interface {
repr() string
}
Expand Down Expand Up @@ -1137,8 +1137,9 @@ func ReadDhcpConfiguration(fd *os.File) (DhcpConfiguration, error) {
return nil, err
}

// This closure is just to the goro that follows it in recursively walking
// through all of the declarations and writing them individually to a chan.
// This closure is just to the goroutine that follows it in recursively
// walking through all the declarations and writing them individually to a
// channel.
var walkDeclarations func(root pDeclaration, out chan *configDeclaration)

walkDeclarations = func(root pDeclaration, out chan *configDeclaration) {
Expand All @@ -1149,15 +1150,15 @@ func ReadDhcpConfiguration(fd *os.File) (DhcpConfiguration, error) {
}
}

// That way this goro can take each individual declaration and write it to
// a channel.
// That way this goroutine can take each individual declaration and write
// it to a channel.
each := make(chan *configDeclaration)
go func(out chan *configDeclaration) {
walkDeclarations(*global, out)
out <- nil
}(each)

// For this loop to convert it into a itemized list.
// For this loop to convert it into an itemized list.
var result DhcpConfiguration
for decl := <-each; decl != nil; decl = <-each {
result = append(result, *decl)
Expand Down Expand Up @@ -1293,8 +1294,7 @@ func tokenizeNetworkingConfig(in chan byte) chan string {
case '\t':
fallthrough
case ' ':
// If we receive whitespace, then this is just a write to our
// state and then we reset.
// Ignore whitespace.
if len(state) == 0 {
continue
}
Expand Down Expand Up @@ -1998,7 +1998,7 @@ func flattenNetworkingConfig(in chan networkingCommandEntry) NetworkingConfig {
// Constructor for networking file
func ReadNetworkingConfig(fd *os.File) (NetworkingConfig, error) {

// start piecing together all of the differents parts of the file and split
// start piecing together all the different parts of the file and split
// it into its individual rows.
fromfile := consumeFile(fd)
tokenized := tokenizeNetworkingConfig(fromfile)
Expand Down Expand Up @@ -2210,7 +2210,7 @@ func filterOutCharacters(ignore []byte, in chan byte) chan byte {

// consumeOpenClosePair consumes bytes within a pair of some bytes, like parentheses, brackets, braces.
// We start by reading bytes until we encounter openByte. These will be returned as
// the first parameter. Then we can enter a goro and consume bytes until we get to
// the first parameter. Then we can enter a goroutine and consume bytes until we get to
// closeByte. At that point we're done, and we can exit.
func consumeOpenClosePair(openByte, closeByte byte, in chan byte) ([]byte, chan byte) {
result := make([]byte, 0)
Expand All @@ -2226,8 +2226,8 @@ func consumeOpenClosePair(openByte, closeByte byte, in chan byte) ([]byte, chan
}
}

// Now we can feed input to our goro and a consumer can see what's contained
// between their requested pairs
// Now we can feed input to our goroutine and a consumer can see what's
// contained between their requested pairs.
out := make(chan byte)
go func(out chan byte) {
by := openByte
Expand Down Expand Up @@ -2301,11 +2301,11 @@ func readDhcpdLeaseEntry(in chan byte) (entry *dhcpLeaseEntry, err error) {
macLineRe := regexp.MustCompile(`hardware\s+ethernet\s+(.+?)\s*$`)
uidLineRe := regexp.MustCompile(`uid\s+(.+?)\s*$`)

/// Read up to the lease item and validate that it actually matches
// Read up to the lease item and validate that it actually matches
lease, ch := consumeOpenClosePair('{', '}', in)

// If we couldn't read the lease, then this item is busted and we're prolly
// done reading the channel.
// If we couldn't read the lease, then this item is mangled and we should
// bail.
if len(lease) == 0 {
return nil, nil
}
Expand All @@ -2317,21 +2317,21 @@ func readDhcpdLeaseEntry(in chan byte) (entry *dhcpLeaseEntry, err error) {
}

if by, ok := <-ch; ok && by == '{' {
// If we found a lease match and we're definitely beginning a lease
// If we found a lease match, and we're definitely beginning a lease
// entry, then create our storage.
entry = &dhcpLeaseEntry{address: matches[1]}

} else if ok {
// If we didn't see a begin brace, then this entry is mangled which
// means that we should probably bail
// If we didn't see a starting brace, then this entry is mangled which
// means that we should probably bail.
return &dhcpLeaseEntry{address: matches[1]}, fmt.Errorf("missing parameters for lease entry %v", matches[1])

} else if !ok {
// If our channel is closed, so we bail "cleanly".
return nil, nil
}

/// Now we can parse the inside of the block.
// Now we can parse the inside of the block.
for insideBraces := true; insideBraces; {
item, ok := consumeUntilSentinel(';', ch)
item_s := string(item)
Expand Down Expand Up @@ -2468,7 +2468,7 @@ func readAppleDhcpdLeaseEntry(in chan byte) (entry *appleDhcpLeaseEntry, err err
var key, val string
switch len(splittedLine) {
case 0:
// should never happens as Split always returns at least 1 item
// This should never happen as Split always returns at least 1 item.
fallthrough
case 1:
log.Printf("error parsing invalid line: `%s`", item_s)
Expand Down
2 changes: 1 addition & 1 deletion builder/vmware/common/driver_workstation9.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

// Template for the network mapper configuration file, 'netmap.conf'.
// This file is used to map network devices to their respective network names.
// This template is used to generate the file if if the default file does not
// This template is used to generate the file if the default file does not
// exist on the system.
const netmapTemplate = `
# This file is automatically generated.
Expand Down
Loading

0 comments on commit 41d3145

Please sign in to comment.