GithubHelp home page GithubHelp logo

hostsfile's People

Contributors

bdclark avatar bookest avatar d-higuchi avatar e100 avatar gnjack avatar guilhem avatar hrak avatar i-gantt avatar nathenharvey avatar nkadel-skyhook avatar rmoriz avatar satiani avatar sclark007 avatar sethvargo avatar tas50 avatar timurb avatar wk8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hostsfile's Issues

update entry without priority set in attributes results to priority 0

Hello

i had an issue with priority.
When i use two update actions without specifying the priority in attributes, chef always update my entries.

hostsfile_entry '192.168.1.2' do
        hostname        'server01.weeta.lab'
        aliases         ['server01', 'server01.test.lab']
        comment         'Update by Chef'
        action          :update
end

hostsfile_entry '192.168.1.3' do
        hostname        'server02.weeta.lab'
        aliases         ['server02', 'server02.test.lab']
        comment         'Update by Chef'
        action          :update
end

After some investigations, i found when priority is not defined in attributes, options[:priority] is nil. Calculated priority of an ipv4 ip (60) is replaced by 0 due to -e.priority.to_i in manipulator unique_entries method. So the updated entry is always moved to the end.
When you only have one entry in your recipe, it's OK but when you have 2 or more entries without static priority, the first one is moved to the end then the second one is moved to the end. It happens each time the chef client is executed.

I resolved my issue by modifying the code like this:

--- entry.rb.orig       2017-08-23 02:34:23.000000000 +0200
+++ entry.rb    2017-11-27 18:51:18.854049200 +0100
@@ -127,8 +127,12 @@
     # @param [Integer] new_priority
     #   the new priority to set
     def priority=(new_priority)
-      @calculated_priority = false
-      @priority = new_priority
+      if new_priority.nil?
+        @priority = calculated_priority
+      else
+        @calculated_priority = false
+        @priority = new_priority
+      end
     end

     # The line representation of this entry.

Rgds
Stéphane Olivier

Cannot split long records

There is a maximum length of a single hosts entry, so in our current environment we simply split them:

127.0.0.1 www.host1.com www2.host1.com www3.host1.com
127.0.0.1 www.host2.com www2.host2.com www3.host2.com
127.0.0.1 www.host3.com www2.host3.com www3.host3.com

How can I replicate this in hostsfile_entry?

I have tried creating multiple hostsfile_entries with the same IP, but they just overwrite each other. How can I either force every IP/Host combination to be it's own record, or group of records?

thanks

ruby syntax error

when trying to upload to my chef server.......

root@chef-server:~/chef-repo# knife cookbook site install hostsfile
Installing hostsfile to /root/chef-repo/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-hostsfile
Downloading hostsfile from the cookbooks site at version 0.2.0 to /root/chef-repo/cookbooks/hostsfile.tar.gz
Cookbook saved: /root/chef-repo/cookbooks/hostsfile.tar.gz
Removing pre-existing version.
Uncompressing hostsfile version 0.2.0.
removing downloaded tarball
1 files updated, committing changes
Creating tag cookbook-site-imported-hostsfile-0.2.0
Checking out the master branch.
Updating 65a4d1c..9e1391c
Fast-forward
 cookbooks/hostsfile/CHANGELOG.md             |   19 +++
 cookbooks/hostsfile/LICENSE                  |   13 ++
 cookbooks/hostsfile/README.md                |  181 ++++++++++++++++++++++++++
 cookbooks/hostsfile/libraries/entry.rb       |   68 ++++++++++
 cookbooks/hostsfile/libraries/manipulator.rb |  121 +++++++++++++++++
 cookbooks/hostsfile/metadata.json            |   29 +++++
 cookbooks/hostsfile/metadata.rb              |    7 +
 cookbooks/hostsfile/providers/entry.rb       |   89 +++++++++++++
 cookbooks/hostsfile/resources/entry.rb       |   33 +++++
 9 files changed, 560 insertions(+)
 create mode 100644 cookbooks/hostsfile/CHANGELOG.md
 create mode 100644 cookbooks/hostsfile/LICENSE
 create mode 100644 cookbooks/hostsfile/README.md
 create mode 100644 cookbooks/hostsfile/libraries/entry.rb
 create mode 100644 cookbooks/hostsfile/libraries/manipulator.rb
 create mode 100644 cookbooks/hostsfile/metadata.json
 create mode 100644 cookbooks/hostsfile/metadata.rb
 create mode 100644 cookbooks/hostsfile/providers/entry.rb
 create mode 100644 cookbooks/hostsfile/resources/entry.rb
Cookbook hostsfile version 0.2.0 successfully installed
root@chef-server:~/chef-repo# knife cookbook upload hostsfile -o cookbooks/
Uploading hostsfile      [0.2.0]
FATAL: Cookbook file libraries/manipulator.rb has a ruby syntax error:
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:18: syntax error, unexpected ':', expecting ')'
FATAL:       ip_address: options[:ip_address],
FATAL:                  ^
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:19: syntax error, unexpected ':', expecting '='
FATAL:       hostname: options[:hostname],
FATAL:                ^
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:20: syntax error, unexpected ':', expecting '='
FATAL:       aliases: options[:aliases],
FATAL:               ^
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:21: syntax error, unexpected ':', expecting '='
FATAL:       comment: options[:comment],
FATAL:               ^
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:22: syntax error, unexpected ':', expecting '='
FATAL:       priority: options[:priority]
FATAL:                ^
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:23: syntax error, unexpected ')', expecting kEND
FATAL: /root/chef-repo/cookbooks/hostsfile/libraries/manipulator.rb:121: syntax error, unexpected $end, expecting kEND

hostsfile_entry resource always sends notifies

hostsfile_entry resource always send notifies even when no action is taken:

  * file[/etc/hosts] action create (up to date)

    - Append hostsfile_entry[localhost]

This is caused by construction like https://github.com/customink-webops/hostsfile/blob/master/providers/entry.rb#L34-L44 which does not look like it is correct: converge_by is used for better support on why_runs (if I got that correctly from
docs) while the File resource used to create the /etc/hosts supports that by itself.

Opscode also says that this kind of usage of converge_by is incorrect: you first need to decide if you need to update the resource and run converge block only after that.

Failing on what should be correct host entries with latest chef (10.16.2)

Trying to get this working, I thought I had done something wrong, so I cut one of the examples in and put it as the first entry.

hostsfile_entry '1.2.3.4' do
  hostname 'example.com'
  action :create
end

Here's what I saw:

[2012-11-02T02:15:46+00:00] INFO: Processing hostsfile_entry[1.2.3.4] action update (uwn_main::hosts line 10)

================================================================================
Error executing action `update` on resource 'hostsfile_entry[1.2.3.4]'
================================================================================

Chef::Exceptions::ValidationFailed
----------------------------------
Required argument ip_address is missing!

Cookbook Trace:
---------------
/var/cache/chef/cookbooks/hostsfile/providers/entry.rb:65:in `class_from_file'

Resource Declaration:
---------------------
# In /var/cache/chef/cookbooks/uwn_main/recipes/hosts.rb

 10: hostsfile_entry '1.2.3.4' do
 11:   hostname 'example.com'
 12:   comment 'Update by Chef'
 13:   action :update
 14: end
 15: 

Compiled Resource:
------------------
# Declared in /var/cache/chef/cookbooks/uwn_main/recipes/hosts.rb:10:in `from_file'

hostsfile_entry("1.2.3.4") do
  recipe_name "hosts"
  retry_delay 2
  action [:update]
  cookbook_name "uwn_main"
  comment "Update by Chef"
  hostname "example.com"
  retries 0
end

[2012-11-02T02:15:46+00:00] ERROR: Running exception handlers
[2012-11-02T02:15:46+00:00] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[2012-11-02T02:15:46+00:00] ERROR: Exception handlers complete
[2012-11-02T02:15:46+00:00] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[2012-11-02T02:15:46+00:00] FATAL: Chef::Exceptions::ValidationFailed: hostsfile_entry[1.2.3.4] (uwn_main::hosts line 10) had an error: Chef::Exceptions::ValidationFailed: Required argument ip_address is missing!

vagrant + chef-solo error

unning chef-solo...
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: *** Chef 10.12.0 ***
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: Run List is []
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: Run List expands to []
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: Starting Chef Run for dev-s
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: Running start handlers
[Sun, 23 Feb 2014 19:47:26 +0000] INFO: Start handlers complete.
[Sun, 23 Feb 2014 19:47:27 +0000] ERROR: Running exception handlers
[Sun, 23 Feb 2014 19:47:27 +0000] ERROR: Exception handlers complete
[Sun, 23 Feb 2014 19:47:27 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[Sun, 23 Feb 2014 19:47:27 +0000] FATAL: SyntaxError: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:74: syntax error, unexpected ':', expecting ')'
      ip_address: options[:ip_address],
                 ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:75: syntax error, unexpected ':', expecting '='
      hostname:   options[:hostname],
               ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:76: syntax error, unexpected ':', expecting '='
      aliases:    options[:aliases],
              ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:77: syntax error, unexpected ':', expecting '='
      comment:    options[:comment],
              ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:78: syntax error, unexpected ':', expecting '='
      priority:   options[:priority],
               ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:79: syntax error, unexpected ')', expecting '='
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:230: syntax error, unexpected ':', expecting ')'
        ip_address: entry.ip_address,
                   ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:231: syntax error, unexpected ':', expecting '='
        hostname:   entry.hostname,
                 ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:232: syntax error, unexpected ':', expecting '='
        aliases:    entry.aliases,
                ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:233: syntax error, unexpected ':', expecting '='
        comment:    entry.comment,
                ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:234: syntax error, unexpected ':', expecting '='
        priority:   !entry.calculated_priority? && entry.priority,
                 ^
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:234: syntax error, unexpected ',', expecting kEND
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:269: syntax error, unexpected $end, expecting kEND
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

Entries can only be appended, unless explicitly removed with "remove" action

The way I use the resource is that I iterate over chef search results and run hostsfile_entry resource for each result (node).
The problem is that when a node gets removed from chef or stops meeting search criteria, it is not removed from /etc/hosts.
I'm wondering, would it be possible to make the resource manage the entire collection of entries it manages. Maybe use comment (or it's part) as identifier rather than (only) ip_address?

Recipe Compile Error: cannot load such file -- entry

Using Chef 11.4 I'm getting the following compile error:

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb
================================================================================


LoadError
---------
cannot load such file -- entry


Cookbook Trace:
---------------
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:21:in `<top (required)>'


Relevant File Content:
----------------------

/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:
14:  # Unless required by applicable law or agreed to in writing, software
15:  # distributed under the License is distributed on an "AS IS" BASIS,
16:  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17:  # See the License for the specific language governing permissions and
18:  # limitations under the License.
19:  #
20:
21>> require 'entry'
22:
23:  require 'chef/application'
24:  require 'digest/sha2'
25:
26:  class Manipulator
27:    attr_reader :node
28:
29:    # Create a new Manipulator object (aka an /etc/hosts manipulator). If a
30:    # hostsfile is not found, a Chef::Application.fatal is risen, causing

multiple entries for one hostname

I've had a request to create multiple entries for the same hostname (because DNS is a problem I guess). The getent command returns both entries when I check to see if it works. I was considering modifying this cookbook and creating a pull request unless the solution offends you (it kind of offends me). But it's possible to do and beats a partial file edit....

If you'd rather keep the functionality pure, I understand.

Hostnames are removed on second run

This appears to be a bug, it's certainly not a useful feature if so designed.

After chef's run once, the correct entry is added to the hosts file:

hostsfile_entry "172.0.100.12" do
  hostname  'chef.ps.com'
  action :create
end

If I run chef again, the entry is totally removed from the hosts file. The logs show:

* hostsfile_entry[172.0.100.12] action create
- Create hostsfile_entry[172.0.100.12]

If I run a third time, it's added back in again.. I have tried with create, append etc.

If I add a second entry, with append or create, on run one, the first entry is added. On run two, the first entry is delete and replaced with the second entry.

Getting "ArgumentError: Cannot find a recipe matching default in cookbook hostsfile"

I'm trying to follow the instructions to install the recipe, and getting the above error. Looking at the repo, it's clear there is no recipes folder. All of the other LWRP's I saw had at least one recipe in the recipes folder.

In another cookbook I'm trying to do this:

include_recipe "hostsfile"

and getting the above error message.

Am I missing something?

not working on os x mavericks ruby 1.9 ?

Darwin x-dx-dev-01.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.2.0]

Recipe:

# 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

CLI Output:

x-dx-dev-01.local Recipe: x-dx-dev-01::default
x-dx-dev-01.local   * hostsfile_entry[127.0.0.1] action create
x-dx-dev-01.local ================================================================================
x-dx-dev-01.local Error executing action `create` on resource 'hostsfile_entry[127.0.0.1]'
x-dx-dev-01.local ================================================================================
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local ArgumentError
x-dx-dev-01.local -------------
x-dx-dev-01.local invalid address
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local Cookbook Trace:
x-dx-dev-01.local ---------------
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:109:in `new'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:109:in `initialize'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:46:in `new'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:46:in `parse'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:226:in `block in collect_and_flatten'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:225:in `each'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:225:in `collect_and_flatten'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:45:in `initialize'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/providers/entry.rb:127:in `new'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/providers/entry.rb:127:in `hostsfile'
x-dx-dev-01.local /var/chef/cache/cookbooks/hostsfile/providers/entry.rb:30:in `block in class_from_file'
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local Resource Declaration:
x-dx-dev-01.local ---------------------
x-dx-dev-01.local # In /var/chef/cache/cookbooks/x-dx-dev-01/recipes/default.rb
x-dx-dev-01.local 
x-dx-dev-01.local   5: hostsfile_entry '127.0.0.1' do
x-dx-dev-01.local   6:  hostname 'x-dx-dev-01.dolox.com'
x-dx-dev-01.local   7:  aliases ['x-dx-dev-01', 'dev.dolox.com', 'localhost']
x-dx-dev-01.local   8:  comment 'Maintained by Chef'
x-dx-dev-01.local   9:  action :create
x-dx-dev-01.local  10: end
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local Compiled Resource:
x-dx-dev-01.local ------------------
x-dx-dev-01.local # Declared in /var/chef/cache/cookbooks/x-dx-dev-01/recipes/default.rb:5:in `from_file'
x-dx-dev-01.local 
x-dx-dev-01.local hostsfile_entry("127.0.0.1") do
x-dx-dev-01.local   action [:create]
x-dx-dev-01.local   retries 0
x-dx-dev-01.local   retry_delay 2
x-dx-dev-01.local   cookbook_name "x-dx-dev-01"
x-dx-dev-01.local   recipe_name "default"
x-dx-dev-01.local   hostname "x-dx-dev-01.dolox.com"
x-dx-dev-01.local   aliases ["x-dx-dev-01", "dev.dolox.com", "localhost"]
x-dx-dev-01.local   comment "Maintained by Chef"
x-dx-dev-01.local end
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local 
x-dx-dev-01.local Running handlers:
x-dx-dev-01.local [2014-02-25T15:54:07-05:00] ERROR: Running exception handlers
x-dx-dev-01.local Running handlers complete
x-dx-dev-01.local 
x-dx-dev-01.local [2014-02-25T15:54:07-05:00] ERROR: Exception handlers complete
x-dx-dev-01.local [2014-02-25T15:54:07-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
x-dx-dev-01.local Chef Client failed. 1 resources updated in 18.475766 seconds
x-dx-dev-01.local [2014-02-25T15:54:07-05:00] ERROR: hostsfile_entry[127.0.0.1] (x-dx-dev-01::default line 5) had an error: ArgumentError: invalid address
x-dx-dev-01.local [2014-02-25T15:54:07-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Atomic file writes

Right now, there's a race conditional with Ruby's file writing. We should look into using Chef's native File resource or at least Chef::FileContentManagement for atomic writes.

LWRP fails

I am using the demo LWRP and its failing right out the gate

Resource Declaration:

---------------------

# In /var/chef/cache/chef-solo-1/cookbooks/hostsfile/recipes/default.rb

  1: hostsfile_entry '1.2.3.4' do
  2:   hostname 'www2.example.com'
  3:   aliases ['foo.com', 'foobar.com']
  4:   comment 'Append by Recipe X'
  5: end

Compiled Resource:

------------------

# Declared in /var/chef/cache/chef-solo-1/cookbooks/hostsfile/recipes/default.rb:1:in `from_file'

hostsfile_entry("1.2.3.4") do
  action :create
  retries 0
  retry_delay 2
  cookbook_name :hostsfile
  recipe_name "default"
  hostname "www2.example.com"
  aliases ["foo.com", "foobar.com"]
  comment "Append by Recipe X"
  ip_address "1.2.3.4"
end

[2012-11-10T20:44:14-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2012-11-10T20:44:14-05:00] DEBUG: ArgumentError: hostsfile_entry[1.2.3.4] (hostsfile::default line 1) had an error: ArgumentError: address family must be specified
/opt/chef/embedded/lib/ruby/1.9.1/ipaddr.rb:460:in `initialize'

Priority is not defined

It's entirely unclear whether priority is published as 'higher priority first' or 'lower priority first'. It's also unclear whether "loopback" priority is derived automatically by deteecting existing entries as loopback, or whether they'd have to be formally specified and published with hostsfile to ensure their correct ordering.

This is particularly an issue for hosts where the FQDN is published both as a loopback and as an external machine IP address.

undefined method `default_action`

I'm using this cookbook for the first time in a vagrant project using chef solo. I am getting this error when it tries to load the LWRPs:

NoMethodError: undefined method `default_action' for #<Class:0x7f2a3ee69a28>
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/resources/entry.rb:24:in `class_from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/resource.rb:504:in `build_from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/resource.rb:480:in `initialize'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/resource.rb:480:in `new'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/resource.rb:480:in `build_from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:96:in `load_lwrp_resources'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:120:in `call'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:120:in `foreach_cookbook_load_segment'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:119:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:119:in `foreach_cookbook_load_segment'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:117:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:117:in `foreach_cookbook_load_segment'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:94:in `load_lwrp_resources'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:59:in `load'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:195:in `setup_run_context'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:159:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:192:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `loop'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:66:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/chef-solo:25
/opt/ruby/bin/chef-solo:19:in `load'
/opt/ruby/bin/chef-solo:19

It looks like the call to default_action :create in resources/entry.rb is causing this issue.

Am I missing something? Or is this a bug?

No default compatibility with FIPS mode

When using the cookbook with FIPS mode enabled on Windows 7, the chef-client command displays this error:

sha512.c(81): OpenSSL internal error, assertion failed: Low level API call to digest SHA512 forbidden in FIPS mode!

I troubleshot this error and I found out manipulator.rb library uses Digest library which is not compatible with the FIPS mode.

I resolved it, using OpenSSL::Digest library instead of Digest library, to hash files.

Unique=true leaves bare IPs in /etc/hosts

It appears that bare ip addresses with no associated hostname can be left dangling in /etc/hosts when using the unique option. An example:

Prior to a chef run, /etc/hosts contains:

vagrant@thing1:~$ cat /etc/hosts
127.0.0.1       thing1 thing1 localhost
127.0.1.1       thing1 thing1

I execute a cookbook containing the following resource:

hostsfile_entry node['ipaddress'] do
  hostname  'thing1'
  aliases   'thing2'
  unique    true
end

The resulting /etc/hosts file contains (note the bare ip-address 127.0.1.1 which has no hostnames associated with it):

vagrant@mikelococo-com-berkshelf:~$ cat /etc/hosts
#
# This file is managed by Chef, using the hostsfile cookbook.
# Editing this file by hand is highly discouraged!
#
# Comments containing an @ sign should not be modified or else
# hostsfile will be unable to guarantee relative priority in
# future Chef runs!
#

127.0.0.1       localhost
127.0.1.1
10.0.3.225      thing1 thing2

Subsequent chef runs error with (no code change since the first successful chef run, operating on Chef 11.8.0, verified via debug logs to be using embedded ruby and not a system ruby). The stack trace includes :

Chef::Exceptions::ValidationFailed
----------------------------------
Required argument ip_address is missing!

The stacktrace for this error includes libraries/entries.rb::parse which indicates this isn't a problem with the resource definition, but with parsing the /etc/hosts file... almost certainly related to he line with no hostnames.

Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/entry.rb:105:in `initialize'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/entry.rb:46:in `new'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/entry.rb:46:in `parse'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:229:in `block in collect_and_flatten'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:228:in `each'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:228:in `collect_and_flatten'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:45:in `initialize'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/providers/entry.rb:126:in `new'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/providers/entry.rb:126:in `hostsfile'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/providers/entry.rb:30:in `block in class_from_file'

Does the unique code handle line removal?

Allow for suppression of hostsfile output.

Thanks for the useful LWRP!

I was wondering if it would be possible to have something like the new sensitive flag (CHEF-4639) for the LWRP which would suppress the diff in the output. With large hosts files, the diff can be kind of annoying.

If this makes sense, I could try and create a PR for the change.

If a hostfile_entry block fails, /etc/hosts is left in a bad state

I ran into this as I was putting together a kitchen test where I had created my nodes incorrectly. They had ipaddresses, but not fqdn (which I was using as the hostname argument).

This resulted in chef crashing out and the hosts file having a line with just an ip address without any hostname to the right of it.

I'll see if I can come up with a patch to fix this - I'm still learning chef/ruby. But the correct behavior for the file modification should be to (Using shell for clarity)

cp /etc/hosts to /etc/hosts.tmp

Make your modifications on hosts.tmp, and only if all the modification operations succeed would you then

mv hosts.tmp hosts

A mv operation on linux and osx is an atomic operation guaranteed(*) to succeed. Otherwise, this cookbook was exactly what I was looking for and a perfect resource. Thanks for sharing your work!

Parser raises on invalid starting file

If my hosts file has a bad entry the parser will throw an exception and not carry on.

I am not sure it is a full issue, but really if I am using chef to fix this I can't use hostsfile cook

given an /etc/hosts with:

127.0.0.1

run will result with the following error:

Error executing action `remove` on resource 'hostsfile_entry[127.0.0.1]'       
================================================================================       


ArgumentError       
-------------       
:ip_address and :hostname are both required options       

ArgumentError: address family must be specified

Seems like d50445e caused a regression in calculate_priority. It now raises the exception: "ArgumentError: address family must be specified". The culprit seems to be re-wrapping ip_address

ip_address = IPAddr.new("192.168.0.1")
IPAddr.new(ip_address, Socket::AF_UNSPEC)

Why are you trying to to re-wrap ip_address?

As a workaround, I'm specifying priority manually

ps. thanks for an otherwise great cookbook.

Create a default recipe to allow for attribute-driven hostsfile entries

This cookbook provides new chef resource types which can be used by other recipes. However, the cookbook does not have any recipes so it doesn't actually do anything on it's own. This is perfectly fine in most situations.

However, there are use cases where it doesn't make sense to create a new cookbook just for the purpose of creating a single entry in /etc/hosts. Or there isn't an existing cookbook which would be appropriate for adding a recipe that configures hostsfile_entry resources.

Those simple use cases would benefit if cookbook hostsfile allowed attribute-driven configuration. No new cookbooks would be required. Simply including hostsfile::default in the runlist and setting some attributes in environment/role/recipe would be enough.

Getting error : syntax error, unexpected ')' in manipulator.rb file

[2013-09-13T14:54:11+00:00] FATAL: SyntaxError: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:78: syntax error, unexpected ')'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:234: syntax error, unexpected ')'
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

Allow control over file resource atomic_update property

When using this cookbook inside a Docker container, it throws the following error:

file[/etc/hosts] (dynamically defined) had an error: Errno::EBUSY: Device or resource busy @ sys_fail2 - (/etc/.chef-hosts20160517-3251-tp1f8b, /etc/hosts)

This issue is discussed here, where @lamont-granquist suggests setting atomic_update false on the resource.

It would be nice if the LWRP would support a property to allow you to control atomic_update.

ordering in hosts

For the moment, We can't set an order in the hosts file. For example, here is my hosts file after hostname cookbook:

127.0.0.1            localhost 
ff02::3              ip6-allhosts 
ff02::1              ip6-allnodes 
ff02::2              ip6-allrouters 
::1                  ip6-localhost ip6-loopback
feo0::0              ip6-localnet 
ff00::0              ip6-mcastprefix 
1.2.3.4              foo.fqdn
127.0.1.1            FQDN HOSTNAME

instead of something like that:

127.0.0.1            localhost 
127.0.1.1            FQDN HOSTNAME
1.2.3.4              foo.fqdn

ff02::3              ip6-allhosts 
ff02::1              ip6-allnodes 
ff02::2              ip6-allrouters 
::1                  ip6-localhost ip6-loopback
feo0::0              ip6-localnet 
ff00::0              ip6-mcastprefix 

hostsfile gem

Hi,

I created a 'hostsfile' gem extracting libraries code to its own package, without dependencies on Chef, so that it can be used by other tools, ruby code scripts, etc...

Would you be interested in someone creating a pull request to add that implementation/package of code instead of the 'libraries'?

Cheers.

syntax error, unexpected ')'

I get these errors:

FATAL: SyntaxError: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:78: syntax error, unexpected ')'
FATAL: SyntaxError: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/hostsfile/libraries/manipulator.rb:234: syntax error, unexpected ')'

/etc/hosts not quite right after run

seems like this version mangles my /etc/hosts a bit... all of the aliases of existing entries get dumped, which means that the fqdn parsing in the OS breaks
what I mean:

before running I have this:

127.0.0.1       localhost.localdomain localhost
192.168.1.10    myhost.mydomain myhost

after running I have this:

127.0.0.1       localhost.localdomain
192.168.1.10    myhost.mydomain
192.168.1.20    the_new_entry

additionally, it doesn't seem like it actually catches duplicates, as another run gives me:

127.0.0.1      localhost.localdomain
192.168.1.10   myhost.mydomain
192.168.1.20   the_new_entry
192.168.1.20   the_new_entry

Thanks!
-Jesse

Setting priority

It doesn't look like priority is working properly when adding multiple hostsfile entries. The first time it is added correctly, but when adding the second entry it re-defines the first priority as a regular ipv4, and so on. So if I call hostsfile_entry multiple times to add multiple IPs, only the last IP has the defined priority and all the previous ones are just using default ipv4.

Is that a bug or am I not using the syntax correctly?

E.g. in this recipe priority of server "one" will be 10 after it processes server "one", but turns immediately to 60 after it processes server "two":

hostsfile_entry "10.1.1.1" do
  hostname "one"
  priority 10
  action :create
end
hostsfile_entry "10.1.1.2" do
  hostname "two"
  priority 10
  action :create
end

Own Entry in new line

Hey ho,

I am currently trying to write a lot of things in my /etc/hosts file and I am totally new to chef. This Recipe is pretty easy and I tried to understand it on my own, but as I had to figure out I have got too less skills in ruby to create a new version with pull request so here is what I would like to have:

action :create_own

which is not appending another ip block, but in stead writing a new line.

Example:

hostsfile_entry '1.2.3.4' do
  hostname 'dev.local'
end
hostsfile_entry '1.2.3.4' do
  hostname 'prod.local'
  action :append
end

will create:

1.2.3.4 dev.local prod.local

But I would like to have:

1.2.3.4 dev.local
1.2.3.4 prod.local

Is this a possible feature?

:update_if_changed action

It would be nice if there was an action to only update the hosts file if the hostname has changed. :create seems to do this but chef never logs an (up to date) entry if nothing has changed and the client summary always notes changes. :create_if_missing of course only runs if there is no entry at all, and :update will always run an update. Combining :create_if_missing with :update of course also will always update. I'd try to fix myself but my ruby knowledge is still in its infancy.

Actions failing with hostnames with embedded hyphens.

Hostnames such as prod-db or qa-1 are failing with errors like below. This behavior occured with both :update and :append actions. I did not test all cases.

I'm more of a python guy, so I haven't looked to deep into the code.

================================================================================
Error executing action `update` on resource 'hostsfile_entry[10.20.31.199]'
================================================================================

NoMethodError
-------------
undefined method `-' for nil:NilClass

Cookbook Trace:
---------------
/var/cache/chef/cookbooks/hostsfile/libraries/manipulator.rb:102:in `block in remove_existing_hostnames'
/var/cache/chef/cookbooks/hostsfile/libraries/manipulator.rb:100:in `collect'
/var/cache/chef/cookbooks/hostsfile/libraries/manipulator.rb:100:in `remove_existing_hostnames'
/var/cache/chef/cookbooks/hostsfile/libraries/manipulator.rb:85:in `unique_entries'
/var/cache/chef/cookbooks/hostsfile/libraries/manipulator.rb:62:in `save!'
/var/cache/chef/cookbooks/hostsfile/providers/entry.rb:71:in `block in class_from_file'

Resource Declaration:
---------------------
# In /var/cache/chef/cookbooks/uwn_hosts/recipes/default.rb

 16: hostsfile_entry '10.20.31.199' do
 17:     hostname 'prod-imq-master.priv.uwnation.net'
 18:     comment 'Production IMQ Cluster master'
 19:     action :update
 20: end
 21: 

Compiled Resource:
------------------
# Declared in /var/cache/chef/cookbooks/uwn_hosts/recipes/default.rb:16:in `from_file'

hostsfile_entry("10.20.31.199") do
  action [:update]
  retries 0
  retry_delay 2
  cookbook_name "uwn_hosts"
  recipe_name "default"
  hostname "prod-imq-master.priv.uwnation.net"
  comment "Production IMQ Cluster master"
  ip_address "10.20.31.199"
end

[2012-11-02T20:43:54+00:00] ERROR: Running exception handlers
[2012-11-02T20:43:54+00:00] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[2012-11-02T20:43:54+00:00] ERROR: Exception handlers complete
[2012-11-02T20:43:54+00:00] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[2012-11-02T20:43:54+00:00] FATAL: NoMethodError: hostsfile_entry[10.20.31.199] (uwn_hosts::default line 16) had an error: NoMethodError: undefined method `-' for nil:NilClass

System Info:

Ubuntu 12.04.1 LTS

Linux prod-imq-master 3.2.0-32-virtual #51-Ubuntu SMP Wed Sep 26 21:53:42 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

bunny (0.8.0, 0.7.9)
chef (10.16.2)
erubis (2.7.0)
highline (1.6.15)
ipaddress (0.8.0)
json (1.7.5, 1.6.1)
mime-types (1.19)
mixlib-authentication (1.3.0)
mixlib-cli (1.2.2)
mixlib-config (1.1.2)
mixlib-log (1.4.1)
mixlib-shellout (1.1.0)
moneta (0.6.0)
net-ssh (2.6.1, 2.2.2)
net-ssh-gateway (1.1.0)
net-ssh-multi (1.1)
ohai (6.14.0)
polyglot (0.3.3)
rest-client (1.6.7)
rubygems-update (1.8.24)
systemu (2.5.2)
treetop (1.4.12)
uuidtools (2.1.3)
yajl-ruby (1.1.0)

hostsfile cookbook fails cookstyle validation

The hostsfile cookbook doesn't pass 'cookstyle -l' validation - it fails on the following errors :

`$ cookstyle -l .
Inspecting 8 files
...WW...

Offenses:

libraries/entry.rb:83:39: W: Shadowing outer local variable - entry.
entry.split(/\s+/).collect { |entry| presence(entry) }.compact
^^^^^
libraries/manipulator.rb:89:16: W: Assignment in condition - you probably meant to use ==.
if entry = find_entry_by_ip_address(options[:ip_address])
^
libraries/manipulator.rb:104:16: W: Assignment in condition - you probably meant to use ==.
if entry = find_entry_by_ip_address(options[:ip_address])
^
libraries/manipulator.rb:124:16: W: Assignment in condition - you probably meant to use ==.
if entry = find_entry_by_ip_address(ip_address)
^
libraries/manipulator.rb:281:39: W: Shadowing outer local variable - entry.
@entries = @entries.collect do |entry|
^^^^^

8 files inspected, 5 offenses detected`

IPv4 address mis-identified as IPv6 address, causing an exception

This might be a base ruby issue; however, this is what the stacktrace is stating:

Generated at 2017-09-27 18:25:26 -0500
IPAddr::InvalidAddressError: hostsfile_entry[10.204.226.141] (my_cookbook::hosts line 46) had an error: IPAddr::InvalidAddressError: invalid address
/opt/chef/embedded/lib/ruby/2.3.0/ipaddr.rb:560:in `in6_addr'
/opt/chef/embedded/lib/ruby/2.3.0/ipaddr.rb:497:in `initialize'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `new'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `initialize'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `new'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `parse'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:257:in `block in collect_and_flatten'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:256:in `each'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:256:in `collect_and_flatten'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:45:in `initialize'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:139:in `new'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:139:in `hostsfile'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:55:in `block in class_from_file'
(eval):2:in `block in action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:361:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:361:in `compile_and_converge_action'
(eval):2:in `action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:145:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource.rb:622:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:69:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:96:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:670:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:665:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:665:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:704:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:284:in `run'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:295:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:248:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:236:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:434:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:57:in `load'
/usr/bin/chef-client:57:in `<main>'

>>>> Caused by IPAddr::InvalidAddressError: invalid address
/opt/chef/embedded/lib/ruby/2.3.0/ipaddr.rb:560:in `in6_addr'
/opt/chef/embedded/lib/ruby/2.3.0/ipaddr.rb:497:in `initialize'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `new'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `initialize'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `new'
/var/chef/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `parse'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:257:in `block in collect_and_flatten'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:256:in `each'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:256:in `collect_and_flatten'
/var/chef/cache/cookbooks/hostsfile/libraries/manipulator.rb:45:in `initialize'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:139:in `new'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:139:in `hostsfile'
/var/chef/cache/cookbooks/hostsfile/providers/entry.rb:55:in `block in class_from_file'
(eval):2:in `block in action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:361:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:361:in `compile_and_converge_action'
(eval):2:in `action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/provider.rb:145:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource.rb:622:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:69:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:97:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/runner.rb:96:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:670:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:665:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:665:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:704:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:284:in `run'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:295:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:248:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:236:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:434:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:57:in `load'
/usr/bin/chef-client:57:in `<main>'

Hostnames no longer unique

Hi, I installed this cookbook and although the readme says that hostnames will be unique across entries, that appears to not be true. It looks like the code that was added to handle this was removed in this commit:

0e1752f

I'm new to Ruby so it's possible that this was intentional and something else is going on but I wanted to mention it. Adding the code back in fixed the issue for me. If it was just an unintentional removal of code, I'm more than happy to fork, commit, and issue a pull request.

How to update IP address if they change?

Let me start out by mentioning I am just starting to learn Chef and Ruby so this could be something obvious.

I have the initial hosts file creation working well using Chef Override Attributes. Have used the append, create, and remove features.

I suspect there is no built in ability to update an existing IP address to a new IP? Simple Example:

1.2.3.4 myalias

I update my attribute from:

            "hostentries":{
              "myalias": {
                "ip": "1.2.3.4",
                "hostname": "myalias"

To:

            "hostentries":{
              "myalias": {
                "ip": "5.6.7.8",
                "hostname": "myalias"

I end up with both entries as such:
1.2.3.4 myalias
5.6.7.8 myalias

I have several ways to get around this but was wondering what might be a standard approach others have taken as this should be a fairly common task.

I have thought to build a hosts file in a separate location say /etc/hosts_chef and if there are any changes copy it over the original /etc/hosts. Another less desirable option - have 2 lists of attributes one to create and others to remove so when one changes add the original to the remove list.

Any tips appreciated. Thanks.

Windows line endings

Using this cookbook on Linux and also Windows servers. On Windows it will leave the hosts file with unix line endings - nothing serious, since the system can us them correctly, more a convenience thing.

Is this even fixable?

unknown "hostfiles" inside resource

I'm getting a rather opaque error when trying to use this cookbook (3.0.1). It's called as part of a loop of host:address pairs. The cookbook depends upon hostfiles in the metadata.rb file.

node['sssd']['hosts'].each_pair do |k,v|
  hostsfile_entry k do
    hostname v
    unique   true
    action   :create
  end
end
NameError
---------
No resource, method, or local variable named `hostsfile' for `Custom resource hostsfile_entry from cookbook hostsfile action provider "10.30.4.38"'

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/hostsfile/resources/entry.rb:35:in `block in class_from_file'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

hostsfile cookbook fails on SMARTOS

This cookbook fails when trying to insert an IP address with an invalid IP address error...

Here is the code that calls it..

hostsfile_entry db_host[0][:ipaddress] do
  hostname db_host[0][:hostname]
  aliases ['dbhost']
  unique true
end

Here is the data that is used...

         * log[[{"name":"test-server","chef_environment":"integration","json_class":"Chef::Node","automatic":{"ipaddress":"10.129.10.200","hostname":"test-server-precise64","fqdn":"test-server-precise64.vagrantup.com","keys":{"ssh":{"host_rsa_public":"random_pub_key"}},"port":"5043"},"normal":{},"chef_type":"node","default":{},"override":{},"run_list":["role[p3-gw]"]}]] action write

Here is the error...

         * hostsfile_entry[10.129.10.200] action create

           ================================================================================
           Error executing action `create` on resource 'hostsfile_entry[10.129.10.200]'
           ================================================================================

           IPAddr::InvalidAddressError
           ---------------------------
           invalid address

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `new'
           /tmp/kitchen/cache/cookbooks/hostsfile/libraries/entry.rb:117:in `initialize'
           /tmp/kitchen/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `new'
           /tmp/kitchen/cache/cookbooks/hostsfile/libraries/entry.rb:54:in `parse'
           /tmp/kitchen/cache/cookbooks/hostsfile/libraries/manipulator.rb:250:in `block in collect_and_flatten'
       /tmp/kitchen/cache/cookbooks/hostsfile/libraries/manipulator.rb:249:in `each'
       /tmp/kitchen/cache/cookbooks/hostsfile/libraries/manipulator.rb:249:in `collect_and_flatten'
       /tmp/kitchen/cache/cookbooks/hostsfile/libraries/manipulator.rb:45:in `initialize'
       /tmp/kitchen/cache/cookbooks/hostsfile/providers/entry.rb:137:in `new'
           /tmp/kitchen/cache/cookbooks/hostsfile/providers/entry.rb:137:in `hostsfile'
           /tmp/kitchen/cache/cookbooks/hostsfile/providers/entry.rb:30:in `block in class_from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/p3_config/recipes/default.rb

           156:     hostsfile_entry db_host[0][:ipaddress] do
       157:       hostname db_host[0][:hostname]
           158:       aliases ['dbhost']
           159:       unique true
       160:     end
           161:   end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/p3_config/recipes/default.rb:156:in `from_file'

           hostsfile_entry("10.129.10.200") do
             action :create
             retries 0
             retry_delay 2
             default_guard_interpreter :default
         declared_type :hostsfile_entry
             cookbook_name "p3_config"
         recipe_name "default"
         hostname "test-server-precise64"
             aliases ["dbhost"]
             unique true
           end


       Running handlers:

We use the same recipe, test node data, and ip address on ubuntu and it works just fine. We think it is something with the IPv6 part of the libraries/entry.rb or the IPADDR ruby...

Thanks!

Error deploying recipe to chef

When I do berks install, I get the following. All of the other cookbooks I use are working

19:53:45.893 [QUIET] [system.out] E, [2014-11-10T19:53:45.890561 #31193] ERROR -- : Cookbook file providers/entry.rb has a ruby syntax error:
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.890889 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:35: syntax error, unexpected ':', expecting ')'
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.890935 #31193] ERROR -- : ip_address: new_resource.ip_address,
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.890980 #31193] ERROR -- : ^
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891028 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:36: syntax error, unexpected ':', expecting '='
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891065 #31193] ERROR -- : hostname: new_resource.hostname,
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891101 #31193] ERROR -- : ^
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891154 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:37: syntax error, unexpected ':', expecting '='
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891203 #31193] ERROR -- : aliases: new_resource.aliases,
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891239 #31193] ERROR -- : ^
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891280 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:38: syntax error, unexpected ':', expecting '='
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891330 #31193] ERROR -- : comment: new_resource.comment,
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891364 #31193] ERROR -- : ^
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891394 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:39: syntax error, unexpected ':', expecting '='
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891433 #31193] ERROR -- : priority: new_resource.priority,
19:53:45.894 [QUIET] [system.out] E, [2014-11-10T19:53:45.891551 #31193] ERROR -- : ^
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891587 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:40: syntax error, unexpected ':', expecting '='
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891618 #31193] ERROR -- : unique: new_resource.unique,
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891648 #31193] ERROR -- : ^
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891678 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:41: syntax error, unexpected ')', expecting '='
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891708 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:58: syntax error, unexpected ':', expecting ')'
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891778 #31193] ERROR -- : ip_address: new_resource.ip_address,
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891808 #31193] ERROR -- : ^
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891854 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:59: syntax error, unexpected ':', expecting '='
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891892 #31193] ERROR -- : hostname: new_resource.hostname,
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891921 #31193] ERROR -- : ^
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.891964 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:60: syntax error, unexpected ':', expecting '='
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.892000 #31193] ERROR -- : aliases: new_resource.aliases,
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.892030 #31193] ERROR -- : ^
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.892072 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:61: syntax error, unexpected ':', expecting '='
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.892107 #31193] ERROR -- : comment: new_resource.comment,
19:53:45.895 [QUIET] [system.out] E, [2014-11-10T19:53:45.892203 #31193] ERROR -- : ^
19:53:45.896 [QUIET] [system.out] E, [2014-11-10T19:53:45.892239 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:62: syntax error, unexpected ':', expecting '='
19:53:45.896 [QUIET] [system.out] E, [2014-11-10T19:53:45.892280 #31193] ERROR -- : priority: new_resource.priority,
19:53:45.896 [QUIET] [system.out] E, [2014-11-10T19:53:45.892315 #31193] ERROR -- : ^
19:53:45.896 [QUIET] [system.out] E, [2014-11-10T19:53:45.892344 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:63: syntax error, unexpected ':', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892375 #31193] ERROR -- : unique: new_resource.unique,
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892415 #31193] ERROR -- : ^
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892452 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:64: syntax error, unexpected ')', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892492 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:78: syntax error, unexpected ':', expecting ')'
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892530 #31193] ERROR -- : ip_address: new_resource.ip_address,
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892559 #31193] ERROR -- : ^
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892589 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:79: syntax error, unexpected ':', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892618 #31193] ERROR -- : hostname: new_resource.hostname,
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892647 #31193] ERROR -- : ^
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892680 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:80: syntax error, unexpected ':', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892724 #31193] ERROR -- : aliases: new_resource.aliases,
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892869 #31193] ERROR -- : ^
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892910 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:81: syntax error, unexpected ':', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892940 #31193] ERROR -- : comment: new_resource.comment,
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892969 #31193] ERROR -- : ^
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.892999 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:82: syntax error, unexpected ':', expecting '='
19:53:45.897 [QUIET] [system.out] E, [2014-11-10T19:53:45.893029 #31193] ERROR -- : priority: new_resource.priority,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893058 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893087 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:83: syntax error, unexpected ':', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893118 #31193] ERROR -- : unique: new_resource.unique,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893147 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893177 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:84: syntax error, unexpected ')', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893215 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:99: syntax error, unexpected ':', expecting ')'
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893255 #31193] ERROR -- : ip_address: new_resource.ip_address,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893284 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893313 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:100: syntax error, unexpected ':', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893343 #31193] ERROR -- : hostname: new_resource.hostname,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893438 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893474 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:101: syntax error, unexpected ':', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893503 #31193] ERROR -- : aliases: new_resource.aliases,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893532 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893561 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:102: syntax error, unexpected ':', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893592 #31193] ERROR -- : comment: new_resource.comment,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893621 #31193] ERROR -- : ^
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893651 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:103: syntax error, unexpected ':', expecting '='
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893699 #31193] ERROR -- : priority: new_resource.priority,
19:53:45.898 [QUIET] [system.out] E, [2014-11-10T19:53:45.893767 #31193] ERROR -- : ^
19:53:45.899 [QUIET] [system.out] E, [2014-11-10T19:53:45.893799 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:104: syntax error, unexpected ':', expecting '='
19:53:45.901 [ERROR] [system.err] There was an error connecting to the Chef Server
19:53:46.021 [QUIET] [system.out] E, [2014-11-10T19:53:45.896385 #31193] ERROR -- : unique: new_resource.unique,
19:53:46.021 [QUIET] [system.out] E, [2014-11-10T19:53:45.896441 #31193] ERROR -- : ^
19:53:46.022 [QUIET] [system.out] E, [2014-11-10T19:53:45.896474 #31193] ERROR -- : /var/lib/jenkins/.berkshelf/cookbooks/hostsfile-2.4.5/providers/entry.rb:105: syntax error, unexpected ')', expecting '='
19:53:46.022 [QUIET] [system.out] E, [2014-11-10T19:53:45.900914 #31193] ERROR -- : Ridley::Errors::CookbookSyntaxError: Invalid ruby files in cookbook: hostsfile (2.4.5).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.