Comments (22)
What does your hostsfile look like?
from hostsfile.
The hostsfile is the stock repo, unmodified.
(version 2.4.3)
Works fine on my 8 other Ubuntu boxes, only seems to be a problem on the Mac dev box.
from hostsfile.
@sgarbesi okay... could you please answer my question? What does it contain? I don't have access to a "stock repo, unmodified". I need a real test case
from hostsfile.
@sethvargo Is this what you're looking for?
hostsfile
knife cookbook site install hostsfile
test cookbook:
knife cookbook create test;
test/metadata.rb:
echo "depends 'hostsfile'" >> test/metdata.rb
test/recipes/default.rb (same code that I previously pasted in my first comment):
# Uniquely enforce our localhost record.
hostsfile_entry '127.0.0.1' do
hostname 'x-dx-dev-01.dolox.com'
aliases ['x-dx-dev-01', 'dev.dolox.com', 'localhost']
comment 'Maintained by Chef'
action :create
end
from hostsfile.
@sgarbesi no, I literally need to see the contents of /etc/hosts
:
$ cat /etc/hosts
from hostsfile.
@sethvargo I can't post that here, it contains sensitive data.
There are several 127.0.0.1 entries; possibly that is the problem?
Is there anything in particular you're looking for that maybe I can see if it's relevant?
from hostsfile.
/etc/hosts (I stripped it down to just this and still get the same error).
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 x-dx-dev-01.dolox.com x-dx-dev-01 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
from hostsfile.
@sgarbesi then you're previous statement that it's a "stock" file is incorrect. I can't help you debug without that information. Basically you either have an entry with an invalid address or an entry without an address, thus making the line invalid.
from hostsfile.
@sethvargo I posted the file stripped down with the test case and it doesn't work?
In other words I changed my hosts file to contain nothing but my previous post and ran the test and received the same error. The hosts file is valid.
from hostsfile.
The error is happening on this line. That means one of the IP addresses in your hostsfile is not valid. It's either blank or malformed.
[1] pry(main)> require 'ipaddr'
=> true
[2] pry(main)> IPAddr.new('127.0.0.1')
=> #<IPAddr: IPv4:127.0.0.1/255.255.255.255>
[3] pry(main)> IPAddr.new('255.255.255.255')
=> #<IPAddr: IPv4:255.255.255.255/255.255.255.255>
[4] pry(main)> IPAddr.new('::1')
=> #<IPAddr: IPv6:0000:0000:0000:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
[5] pry(main)> IPAddr.new('fe80::1%lo0')
IPAddr::InvalidAddressError: invalid address
from /Users/sethvargo/.rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/ipaddr.rb:559:in `in6_addr'
So Ruby thinks fe80::1%lo0
isn't a valid IPv6 address. There's not much I can do here - IPAddr is a core Ruby class. So if it's blowing up, that address either isn't valid or the Ruby core has a bug.
from hostsfile.
Actually, there's a test in MRI explicitly testing that an address of that format DOES raise an error: https://github.com/ruby/ruby/blob/trunk/lib/ipaddr.rb#L738
from hostsfile.
@sethvargo Okay.
This is the stock /etc/hosts file that Apple ships with OS X Mavericks.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
from hostsfile.
Right. And, according to Ruby, fe80::1%lo0
is not a valid IPv6 address.
from hostsfile.
@sethvargo Alright then; not sure if it's worth posting in the wiki/readme or not.
Removing fe80::1%lo0 localhost
allows it to run without error.
Thanks for the help! Appreciate it.
from hostsfile.
@sgarbesi well I need to figure out what to do. This might actually be a bug in OSX Mavericks (since all indications say that is NOT a valid IPv6 address).
from hostsfile.
Sigh. See also: http://johncblandii.com/2011/07/osx-lion-gotcha-etchosts-file.html
from hostsfile.
Blarg. https://bugs.ruby-lang.org/issues/8464
from hostsfile.
@sethvargo Ouch :/
Personal opinion: I would post it in the README/Wiki and call it a day.
from hostsfile.
from hostsfile.
v2.4.4
from hostsfile.
Tested and works fine on v2.4.4.
Thanks again @sethvargo !
from hostsfile.
Yup
from hostsfile.
Related Issues (20)
- create backup file HOT 1
- Chef 18 deprecation warnings
- Sous chefs adoption
- IPV6 loopback is not correctly detected and prioritized as loopback. HOT 2
- lazy not working HOT 1
- Cannot split long records HOT 3
- hostsfile cookbook fails on SMARTOS HOT 14
- Windows line endings HOT 1
- How to update IP address if they change? HOT 4
- If a hostfile_entry block fails, /etc/hosts is left in a bad state
- Windows limit of 9 aliases per line
- Using the 'comment' attribute in a 'hostsfile_entry' resource block ruins the idempotence of the resource then
- Allow control over file resource atomic_update property HOT 2
- No default compatibility with FIPS mode HOT 1
- Create a default recipe to allow for attribute-driven hostsfile entries
- Entries can only be appended, unless explicitly removed with "remove" action HOT 1
- unknown "hostfiles" inside resource HOT 1
- IPv4 address mis-identified as IPv6 address, causing an exception
- update entry without priority set in attributes results to priority 0
- hostsfile cookbook fails cookstyle validation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hostsfile.