Skip to content

Commit

Permalink
Added a "elasticsearch::customize" attribute file to customize the co…
Browse files Browse the repository at this point in the history
…okbook's default attributes

Closes #208

Related: #112, #168, #178, #179, #180, #196, #208
  • Loading branch information
stuart-warren authored and karmi committed May 7, 2014
1 parent eb49ff6 commit e5ebce0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.markdown
Expand Up @@ -261,6 +261,15 @@ END
ssh ... "sudo chef-solo -N elasticsearch-wrapper-cookbook-test -j node.json"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For customizing the default attributes, there's a `elasticsearch::customize` recipe,
which solves -- for the time being -- problems when over-riding the attributes.

Create a `elasticsearch/attributes/customize.rb` file in your wrapper cookbook,
and place any attribute overrides there:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
echo "normal[:elasticsearch][:version] = '1.1.0'" > my-elasticsearch/attributes/customize.rb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Nginx Proxy
-----------
Expand Down
9 changes: 9 additions & 0 deletions attributes/customize.rb
@@ -0,0 +1,9 @@
# Override the cookbook's default attributes in this file.
#
# Usually, you don't change this file directly, but you'll create a "elasticsearch/attributes/customize.rb" file
# in your wrapper cookbook and put the overrides in that file.
#
# The following shows how to override the Elasticsearch version and cluster name settings:
#
# normal[:elasticsearch][:version] = '1.1.0'
# normal[:elasticsearch][:cluster][:name] = 'my-cluster'
3 changes: 3 additions & 0 deletions attributes/default.rb
Expand Up @@ -7,6 +7,9 @@
#
node.default[:elasticsearch] ||= {}
node.normal[:elasticsearch] ||= {}

include_attribute 'elasticsearch::customize'

node.normal[:elasticsearch] = DeepMerge.merge(node.default[:elasticsearch].to_hash, node.normal[:elasticsearch].to_hash)
node.normal[:elasticsearch] = DeepMerge.merge(node.normal[:elasticsearch].to_hash, settings.to_hash)

Expand Down

0 comments on commit e5ebce0

Please sign in to comment.