From e5770a3aa2c47e23ead7eedb0a0b3b20a365e89a Mon Sep 17 00:00:00 2001 From: jakekdodd Date: Wed, 17 Sep 2014 11:45:34 -0700 Subject: [PATCH 1/4] set elasticsearch[:download_url] to nil Computing attributes like this, in the attributes file, causes really confusing behavior at runtime. Setting ``elasticsearch[:download_url]`` to nil, and computing at runtime instead. User can override the attribute in a wrapper cookbook and the recipe will actually respect that override. --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index fc995d6eb..73a1e6832 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,7 +20,7 @@ default.elasticsearch[:host] = "http://download.elasticsearch.org" default.elasticsearch[:repository] = "elasticsearch/elasticsearch" default.elasticsearch[:filename] = "elasticsearch-#{node.elasticsearch[:version]}.tar.gz" -default.elasticsearch[:download_url] = [node.elasticsearch[:host], node.elasticsearch[:repository], node.elasticsearch[:filename]].join('/') +default.elasticsearch[:download_url] = nil # === NAMING # From e73baf75caca2540591d7fdedaa1ec3b919526e7 Mon Sep 17 00:00:00 2001 From: jakekdodd Date: Wed, 17 Sep 2014 11:47:16 -0700 Subject: [PATCH 2/4] Update default.rb --- recipes/default.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/default.rb b/recipes/default.rb index 30892ce9c..014da6076 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -78,9 +78,11 @@ # ark_prefix_root = node.elasticsearch[:dir] || node.ark[:prefix_root] ark_prefix_home = node.elasticsearch[:dir] || node.ark[:prefix_home] +download_url = node.elasticsearch[:download_url] || [node.elasticsearch[:host], + node.elasticsearch[:repository], node.elasticsearch[:filename]].join('/') ark "elasticsearch" do - url node.elasticsearch[:download_url] + url download_url owner node.elasticsearch[:user] group node.elasticsearch[:user] version node.elasticsearch[:version] From e05eab599bcb56e42d2a5859662657fded1ab888 Mon Sep 17 00:00:00 2001 From: jakekdodd Date: Wed, 17 Sep 2014 12:17:59 -0700 Subject: [PATCH 3/4] filename should not be computed --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 73a1e6832..421b936c3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -19,7 +19,7 @@ default.elasticsearch[:version] = "0.90.12" default.elasticsearch[:host] = "http://download.elasticsearch.org" default.elasticsearch[:repository] = "elasticsearch/elasticsearch" -default.elasticsearch[:filename] = "elasticsearch-#{node.elasticsearch[:version]}.tar.gz" +default.elasticsearch[:filename] = nil default.elasticsearch[:download_url] = nil # === NAMING From 4e55d655dae3850974ef857bda4d4b4b7b1a328f Mon Sep 17 00:00:00 2001 From: jakekdodd Date: Wed, 17 Sep 2014 12:18:46 -0700 Subject: [PATCH 4/4] Update default.rb --- recipes/default.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/default.rb b/recipes/default.rb index 014da6076..322af0ef9 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -78,8 +78,9 @@ # ark_prefix_root = node.elasticsearch[:dir] || node.ark[:prefix_root] ark_prefix_home = node.elasticsearch[:dir] || node.ark[:prefix_home] +filename = node.elasticsearch[:filename] || "elasticsearch-#{node.elasticsearch[:version]}.tar.gz" download_url = node.elasticsearch[:download_url] || [node.elasticsearch[:host], - node.elasticsearch[:repository], node.elasticsearch[:filename]].join('/') + node.elasticsearch[:repository], filename].join('/') ark "elasticsearch" do url download_url