Skip to content

Fix vmware-iso validation by explicitly setting tools_mode - #1673

Merged
Stromweld merged 6 commits into
chef:mainfrom
t-mtsmt:fix/vmware-tools-mode
May 29, 2026
Merged

Stromweld merged 6 commits into
chef:mainfrom
t-mtsmt:fix/vmware-tools-mode

Conversation

@t-mtsmt

@t-mtsmt t-mtsmt commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Description

This change fixes vmware-iso validation when VMware tools upload settings are configured.

Bento already sets tools_upload_flavor and tools_upload_path for VMware builds, but does not set tools_mode. With current VMware builder validation, tools_mode must be explicitly specified whenever tools configuration is present.

Without this change, validation fails with the following error:

Error: 1 error(s) occurred:

* 'tools_mode' must be explicitly specified when using any tools configuration

  on packer_templates\pkr-sources.pkr.hcl line 547:
  (source code not available)

This PR adds a vmware_tools_mode variable, derives a default value from the existing upload configuration, and passes tools_mode to the vmware-iso source.

The default behavior remains the same:

  • use upload when a VMware tools upload flavor is configured
  • use disable when no upload flavor is available
  • allow explicit override through vmware_tools_mode

Related Issue

No related issue.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@t-mtsmt
t-mtsmt requested review from a team and Stromweld as code owners March 17, 2026 18:12
@sonarqubecloud

Copy link
Copy Markdown

@Stromweld

Copy link
Copy Markdown
Collaborator

now that they have attach fixed I think this should default to attach. upload was only used as it was the only one supported for all platforms. Attach speeds things up since it doesn't have to spend the time copying the iso to the server.

Comment thread packer_templates/pkr-sources.pkr.hcl Outdated
@Stromweld
Stromweld force-pushed the fix/vmware-tools-mode branch from 4761120 to 2a47574 Compare May 1, 2026 12:57
@sonarqubecloud

sonarqubecloud Bot commented May 1, 2026

Copy link
Copy Markdown

Signed-off-by: Takashi Matsumoto <tmtsmt.sec@gmail.com>
@Stromweld
Stromweld force-pushed the fix/vmware-tools-mode branch from 2a47574 to ff5a46f Compare May 27, 2026 21:12
- Change tools_mode default from 'upload' to 'attach' for better performance
- Add tools_source_path with smart defaults based on host OS and guest type
  - Automatically detects VMware Fusion paths on macOS
  - Automatically detects VMware Workstation paths on Linux
  - Handles x86_64 and aarch64 architectures
  - Correctly selects windows.iso, linux.iso, or darwin.iso based on guest type
- Implement proper mutual exclusivity per VMware plugin documentation:
  - tools_source_path: Can be used with both 'attach' and 'upload' modes
  - tools_upload_flavor: Only used when tools_mode is 'upload' AND
    tools_source_path is null
  - These two options cannot be used together per plugin requirements
- Make tools_upload_path conditional (only set when tools_mode is 'upload')
- Add helpful descriptions to all VMware tools variables
- Allow user overrides of all settings via variables

This improves on the original PR by defaulting to the faster 'attach' mode
instead of 'upload' mode, while properly implementing the mutual exclusivity
requirements from the Packer VMware plugin documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
Stromweld added 4 commits May 29, 2026 14:41
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
@Stromweld
Stromweld merged commit 27d6289 into chef:main May 29, 2026
16 of 269 checks passed
SamuelMarks pushed a commit to SamuelMarks/bento that referenced this pull request Aug 21, 2026
* Fix vmware-iso validation by explicitly setting tools_mode

Signed-off-by: Takashi Matsumoto <tmtsmt.sec@gmail.com>

* Improve VMware tools configuration for better performance

- Change tools_mode default from 'upload' to 'attach' for better performance
- Implement proper mutual exclusivity per VMware plugin documentation:
  - tools_source_path: Can be used with both 'attach' and 'upload' modes
  - tools_upload_flavor: Only used when tools_mode is 'upload' AND
    tools_source_path is null
  - These two options cannot be used together per plugin requirements
- Make tools_upload_path conditional (only set when tools_mode is 'upload')
- Allow user overrides of all settings via variables

This improves on the original PR by defaulting to the faster 'attach' mode
instead of 'upload' mode, while properly implementing the mutual exclusivity
requirements from the Packer VMware plugin documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>

* clean up tools code
* update vmware tools install scripts

Signed-off-by: Corey Hemminger <hemminger@hotmail.com>

---------

Signed-off-by: Takashi Matsumoto <tmtsmt.sec@gmail.com>
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
Co-authored-by: Corey Hemminger <hemminger@hotmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants