Skip to content

java_home doesn't honor role attributes #102

Description

@samperman

I've created a role that sets the jdk_version and install_flavor. It results int he correct version of java being installed, but the JAVA_HOME results in some strange directory names.

The role looks like this:

{
  "name": "javatest",
  "description": "Test starting java",
  "json_class": "Chef::Role",
  "chef_type": "role",
  "override_attributes": {
    "java": {
      "jdk_version": 7,
      "install_flavor": "oracle",
      "oracle": {
        "accept_oracle_download_terms": true
      }
    }
  },
  "run_list": [
    "recipe[apt::default]",
    "recipe[java]"
  ]
}

Here is an ssh session that shows that JAVA_HOME points to a very confusingly named directory.

vagrant@ubuntu-vagrant:~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64
vagrant@ubuntu-vagrant:~$ ll /usr/lib/jvm/
total 16
drwxr-xr-x  3 root root 4096 Dec 15 21:54 ./
drwxr-xr-x 51 root root 4096 Dec 15 21:53 ../
lrwxrwxrwx  1 root root   24 Dec 15 21:54 java-6-openjdk-amd64 -> /usr/lib/jvm/jdk1.7.0_25/
-rw-------  1 root root 2594 Dec 15 21:54 .java-6-openjdk-amd64.jinfo
drwxr-xr-x  8  500  143 4096 Jun  6  2013 jdk1.7.0_25/
vagrant@ubuntu-vagrant:~$ cat /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64vagrant@ubuntu-vagrant:~$
vagrant@ubuntu-vagrant:~$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Am I setting the attributes incorrectly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions