Skip to content

refactor: tools upload flavors#219

Merged
lbajolet-hashicorp merged 1 commit intomainfrom
refactor/tools-config
Aug 8, 2024
Merged

refactor: tools upload flavors#219
lbajolet-hashicorp merged 1 commit intomainfrom
refactor/tools-config

Conversation

@tenthirtyam
Copy link
Copy Markdown
Collaborator

@tenthirtyam tenthirtyam commented Jul 7, 2024

Description

Refactors to use allowedToolsFlavorValues for tools upload flavor options based on constants.

Testing

✅ Standard

packer-plugin-vmware on  refactor/tools-config [$!] via 🐹 v1.22.5 go fmt ./... 

packer-plugin-vmware on  refactor/tools-config [$!] via 🐹 v1.22.5 make generate
2024/08/06 18:07:58 Copying "docs" to ".docs/"
2024/08/06 18:07:58 Replacing @include '...' calls in .docs/
Compiling MDX docs in '.docs' to Markdown in '.web-docs'...

packer-plugin-vmware on  refactor/tools-config [$!] via 🐹 v1.22.5 make build

packer-plugin-vmware on  refactor/tools-config [$!] via 🐹 v1.22.5 make test
?       github.com/hashicorp/packer-plugin-vmware       [no test files]
?       github.com/hashicorp/packer-plugin-vmware/version       [no test files]
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/common 6.666s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/iso    1.516s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/vmx    1.888s

packer-plugin-vmware on  refactor/tools-config [$!] via 🐹 v1.22.5 took 8.4s make dev 
packer plugins install --path packer-plugin-vmware "github.com/hashicorp/vmware"
Successfully installed plugin github.com/hashicorp/vmware from /Users/ryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Personal/packer-plugin-vmware/packer-plugin-vmware to /Users/ryan/.packer.d/plugins/github.com/hashicorp/vmware/packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_arm64

✅ Configuration

  1. 'foo'
source "vmware-iso" "vagrant-vmw" {
  # ... brevity ...
  tools_upload_flavor = "foo"
}
✦7 ➜ PACKER_LOG=1 PACKER_LOG_PATH=packer.log packer build --force -var-file=photon-4.0-R2.pkrvars.hcl .
Error: 1 error(s) occurred:

* invalid 'tools_upload_flavor' specified: foo; must be one of darwin, linux, windows
  1. 'linux'
source "vmware-iso" "vagrant-vmw" {
  # ... brevity ...
  tools_upload_flavor = "linux"
}
==> vmware-iso.vagrant-vmw: Connected to SSH!
==> vmware-iso.vagrant-vmw: Uploading VMware Tools (linux)...
==> vmware-iso.vagrant-vmw: Provisioning with shell script: /Users/johnsonryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Work/photon-packer-templates/scripts/system/update-packages.sh
2024/08/06 18:33:55 ui: �[1;32m==> vmware-iso.vagrant-vmw: Connected to SSH!�[0m
2024/08/06 18:33:55 ui: �[1;32m==> vmware-iso.vagrant-vmw: Uploading VMware Tools (linux)...�[0m
2024/08/06 18:33:55 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:55 [DEBUG] Opening new ssh session
2024/08/06 18:33:55 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:55 [DEBUG] Starting remote scp process:  scp -vt .
2024/08/06 18:33:55 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:55 [DEBUG] Started SCP session, beginning transfers...
2024/08/06 18:33:55 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:55 [DEBUG] Copying input data into temporary file so we can read the length
2024/08/06 18:33:55 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:55 [DEBUG] scp: Uploading linux.iso: perms=C0644 size=58617856
2024/08/06 18:33:56 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:56 [DEBUG] SCP session complete, closing stdin pipe.
2024/08/06 18:33:56 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:56 [DEBUG] Waiting for SSH session to complete.
2024/08/06 18:33:56 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/06 18:33:56 [DEBUG] scp stderr (length 70): Sink: C0644 58617856 linux.iso
2024/08/06 18:33:56 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: scp: debug1: fd 0 clearing O_NONBLOCK

@tenthirtyam tenthirtyam self-assigned this Jul 7, 2024
@tenthirtyam tenthirtyam changed the title refactor: tools upload flavors 🚧 refactor: tools upload flavors Jul 7, 2024
@tenthirtyam tenthirtyam force-pushed the refactor/tools-config branch from bc0cc35 to 541db81 Compare July 7, 2024 03:20
@tenthirtyam tenthirtyam added this to the v1.1.0 milestone Jul 17, 2024
@tenthirtyam tenthirtyam force-pushed the refactor/tools-config branch 3 times, most recently from 1363c61 to 8e71e70 Compare August 6, 2024 22:30
@tenthirtyam tenthirtyam changed the title 🚧 refactor: tools upload flavors refactor: tools upload flavors Aug 6, 2024
@tenthirtyam tenthirtyam marked this pull request as ready for review August 6, 2024 22:35
@tenthirtyam tenthirtyam requested a review from a team as a code owner August 6, 2024 22:35
Copy link
Copy Markdown
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few nits, but overall the change looks good to me! Pre-approving to not block a later merge, I'll let you address those @tenthirtyam and will do another review then!

@tenthirtyam tenthirtyam force-pushed the refactor/tools-config branch from 8e71e70 to 4b89195 Compare August 8, 2024 18:01
return nil
}

errs := []error{}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, I would create this as a var to have the returned slice be nil, that way you can compare the returned slice to nil, as it will effectively be if no errors have been found.

That said, given there's only one error returned at a time, is there a reason this is a slice of errors instead of a single error?

@tenthirtyam tenthirtyam force-pushed the refactor/tools-config branch from 4b89195 to 2e10918 Compare August 8, 2024 18:14
Refactors to use `allowedToolsFlavorValues` for tools upload flavor options based on constants.

Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
@tenthirtyam tenthirtyam force-pushed the refactor/tools-config branch from 2e10918 to 0c09a50 Compare August 8, 2024 18:25
@lbajolet-hashicorp lbajolet-hashicorp merged commit b14af52 into main Aug 8, 2024
@lbajolet-hashicorp lbajolet-hashicorp deleted the refactor/tools-config branch August 8, 2024 18:30
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 1, 2026

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants