Skip to content

Commit 94e4f22

Browse files
committed
Allow override of cookbook on templates in _config
- Add additional parameters to `elasticsearch_configure` to support using templates from other cookbooks. Fixes sous-chefs#376.
1 parent c34e81c commit 94e4f22

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

libraries/provider_configure.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ElasticsearchCookbook::ConfigureProvider < Chef::Provider::LWRPBase
9292
shell_template = template 'elasticsearch.in.sh' do
9393
path node['platform_family'] == 'rhel' ? '/etc/sysconfig/elasticsearch' : '/etc/default/elasticsearch'
9494
source new_resource.template_elasticsearch_env
95-
cookbook 'elasticsearch'
95+
cookbook new_resource.cookbook_elasticsearch_env
9696
mode 0755
9797
variables(params: params)
9898
action :nothing
@@ -105,7 +105,7 @@ class ElasticsearchCookbook::ConfigureProvider < Chef::Provider::LWRPBase
105105
logging_template = template 'logging.yml' do
106106
path "#{new_resource.path_conf[es_install.type]}/logging.yml"
107107
source new_resource.template_logging_yml
108-
cookbook 'elasticsearch'
108+
cookbook new_resource.cookbook_logging_yml
109109
owner es_user.username
110110
group es_user.groupname
111111
mode 0755
@@ -127,7 +127,7 @@ class ElasticsearchCookbook::ConfigureProvider < Chef::Provider::LWRPBase
127127
yml_template = template 'elasticsearch.yml' do
128128
path "#{new_resource.path_conf[es_install.type]}/elasticsearch.yml"
129129
source new_resource.template_elasticsearch_yml
130-
cookbook 'elasticsearch'
130+
cookbook new_resource.cookbook_elasticsearch_yml
131131
owner es_user.username
132132
group es_user.groupname
133133
mode 0755

libraries/resource_configure.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ class ElasticsearchCookbook::ConfigureResource < Chef::Resource::LWRPBase
4040
})
4141

4242
attribute(:template_elasticsearch_env, kind_of: String, default: 'elasticsearch.in.sh.erb')
43+
attribute(:cookbook_elasticsearch_env, kind_of: String, default: 'elasticsearch')
44+
4345
attribute(:template_elasticsearch_yml, kind_of: String, default: 'elasticsearch.yml.erb')
46+
attribute(:cookbook_elasticsearch_yml, kind_of: String, default: 'elasticsearch')
47+
4448
attribute(:template_logging_yml, kind_of: String, default: 'logging.yml.erb')
49+
attribute(:cookbook_logging_yml, kind_of: String, default: 'elasticsearch')
4550

4651
attribute(:logging, kind_of: Hash, default: {})
4752

0 commit comments

Comments
 (0)