Skip to content

Commit

Permalink
Specify windows attributes in attribute files
Browse files Browse the repository at this point in the history
This moves windows attributes back to the attribute file.
sous-chefs#95 moved these to the recipe,
however that prevents setting these attributes in a wrapper cookbook's
attribute file.

This ensures that only attributes which depend on jdk_version are set
in the recipe.  All other attributes are set in the attribute file like
normal.
  • Loading branch information
blt04 committed Dec 17, 2013
1 parent b172308 commit e301d66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 10 additions & 1 deletion attributes/default.rb
Expand Up @@ -21,12 +21,21 @@
default['java']['remove_deprecated_packages'] = false

# default jdk attributes
default['java']['install_flavor'] = "openjdk"
default['java']['jdk_version'] = '6'
default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "x86_64" : "i586"
default['java']['openjdk_packages'] = []
default['java']['accept_license_agreement'] = false

case node['platform_family']
when "windows"
default['java']['install_flavor'] = "windows"
default['java']['windows']['url'] = nil
default['java']['windows']['checksum'] = nil
default['java']['windows']['package_name'] = "Java(TM) SE Development Kit 7 (64-bit)"
else
default['java']['install_flavor'] = "openjdk"
end

case node['java']['install_flavor']
when 'ibm', 'ibm_tar'
default['java']['ibm']['url'] = nil
Expand Down
8 changes: 3 additions & 5 deletions recipes/default.rb
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

# Calculate variables that depend on jdk_version
# If you need to override this in an attribute file you must use
# force_default or higher precedence.
case node['platform_family']
when "rhel", "fedora"
node.default['java']['java_home'] = "/usr/lib/jvm/java"
Expand All @@ -28,11 +31,6 @@
when "arch"
node.default['java']['java_home'] = "/usr/lib/jvm/java-#{node['java']['jdk_version']}-openjdk"
node.default['java']['openjdk_packages'] = ["openjdk#{node['java']['jdk_version']}}"]
when "windows"
node.default['java']['install_flavor'] = "windows"
node.default['java']['windows']['url'] = nil
node.default['java']['windows']['checksum'] = nil
node.default['java']['windows']['package_name'] = "Java(TM) SE Development Kit 7 (64-bit)"
when "debian"
node.default['java']['java_home'] = "/usr/lib/jvm/java-#{node['java']['jdk_version']}-#{node['java']['install_flavor']}"
# Newer Debian & Ubuntu adds the architecture to the path
Expand Down

0 comments on commit e301d66

Please sign in to comment.