Commit ae33856
committed
Replace DNS resolution with hosts file checking
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 compatibility1 parent 0349fdd commit ae33856
1 file changed
+24
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
101 | 118 | | |
102 | 119 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
112 | 125 | | |
113 | 126 | | |
114 | | - | |
115 | | - | |
116 | 127 | | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
| |||
0 commit comments