Skip to content

Conversation

@tomjn
Copy link
Contributor

@tomjn tomjn commented Dec 30, 2025

Changes:

  • Removed dependency on resolv library
  • Added hosts_entry_exists?() method using CLI check command
  • Updated check_hostnames_to_add() to use hosts file checking

Benefits:

  • No sudo required for checking if hosts exist
  • Only requests sudo when hosts are actually missing
  • Checks hosts file directly instead of DNS resolution
  • Prevents unnecessary privilege escalation

How it works:

  • Uses bundled CLI binary's check command (read-only, no sudo)
  • CLI check command reads /etc/hosts directly
  • Returns success if IP/hostname mapping exists
  • Only adds hosts that are actually missing

Requires:

Changes:
- Removed dependency on 'resolv' library
- Added hosts_entry_exists?() method using CLI check command
- Updated check_hostnames_to_add() to use hosts file checking

Benefits:
- No sudo required for checking if hosts exist
- Only requests sudo when hosts are actually missing
- Checks hosts file directly instead of DNS resolution
- Prevents unnecessary privilege escalation

How it works:
- Uses bundled CLI binary's check command (read-only, no sudo)
- CLI check command reads /etc/hosts directly
- Returns success if IP/hostname mapping exists
- Only adds hosts that are actually missing

This resolves VVV pain point:
- No more unnecessary sudo prompts on `vagrant up`
- Vagrant only requests sudo when hosts need to be added
- Existing hosts in /etc/hosts are properly detected

Note: Requires CLI with batch check support
Will work with individual checks for backward compatibility
@tomjn tomjn requested a review from Mte90 December 30, 2025 18:02
@tomjn tomjn added the enhancement New feature or request label Dec 30, 2025
@tomjn tomjn requested a review from luthermonson January 5, 2026 23:26
RuboCop was flagging stdout and stderr as useless assignments in
hosts_entry_exists? since only the exit status is checked.
@Mte90 Mte90 merged commit 4c7d201 into main Jan 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants