Replace DNS resolution with hosts file checking#58
Merged
Conversation
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
RuboCop was flagging stdout and stderr as useless assignments in hosts_entry_exists? since only the exit status is checked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
resolvlibraryBenefits:
How it works:
Requires: