From fc5c1a4a49b0bf15a927b5a4264bdbe5bd1c6410 Mon Sep 17 00:00:00 2001 From: Russ Teabeault Date: Fri, 7 Mar 2014 16:13:35 -0700 Subject: [PATCH 1/2] Issue #134 Remove /var/lib/alternatives/#{cmd} before calling alternatives. This seems to fix the problem that we are seeing where jar does not get properly linked. What we were seeing is the same as described here http://johnglotzer.blogspot.com/2012/09/alternatives-install-gets-stuck-failed.html --- providers/alternatives.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/providers/alternatives.rb b/providers/alternatives.rb index df3cf1bd..08076a74 100644 --- a/providers/alternatives.rb +++ b/providers/alternatives.rb @@ -38,6 +38,7 @@ description = "Add alternative for #{cmd}" converge_by(description) do Chef::Log.debug "Adding alternative for #{cmd}" + shell_out("rm /var/lib/alternatives/#{cmd}") install_cmd = shell_out("#{alternatives_cmd} --install #{bin_path} #{cmd} #{alt_path} #{priority}") unless install_cmd.exitstatus == 0 Chef::Application.fatal!(%Q[ set alternative failed ]) From 7cbe5ebc61903b2b25020c6f7ff9f8a1d99cf445 Mon Sep 17 00:00:00 2001 From: Russ Teabeault Date: Mon, 10 Mar 2014 14:11:33 -0600 Subject: [PATCH 2/2] Issue #134 - Adding tests to catch unlinked jar command --- test/integration/openjdk-7/bats/verify_openjdk-7.bats | 5 +++++ test/integration/openjdk/bats/verify_openjdk.bats | 5 +++++ test/integration/oracle-7/bats/verify_oracle-7.bats | 5 +++++ test/integration/oracle/bats/verify_oracle.bats | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/test/integration/openjdk-7/bats/verify_openjdk-7.bats b/test/integration/openjdk-7/bats/verify_openjdk-7.bats index 92e1c219..dcba2d1f 100644 --- a/test/integration/openjdk-7/bats/verify_openjdk-7.bats +++ b/test/integration/openjdk-7/bats/verify_openjdk-7.bats @@ -7,3 +7,8 @@ run test -d $JAVA_HOME [ "$status" -eq 0 ] } + +@test "properly links jar" { + run test -L /usr/bin/jar + [ "$status" -eq 0 ] +} diff --git a/test/integration/openjdk/bats/verify_openjdk.bats b/test/integration/openjdk/bats/verify_openjdk.bats index 32432388..a617a032 100644 --- a/test/integration/openjdk/bats/verify_openjdk.bats +++ b/test/integration/openjdk/bats/verify_openjdk.bats @@ -7,3 +7,8 @@ run test -d $JAVA_HOME [ "$status" -eq 0 ] } + +@test "properly links jar" { + run test -L /usr/bin/jar + [ "$status" -eq 0 ] +} diff --git a/test/integration/oracle-7/bats/verify_oracle-7.bats b/test/integration/oracle-7/bats/verify_oracle-7.bats index 92e1c219..dcba2d1f 100644 --- a/test/integration/oracle-7/bats/verify_oracle-7.bats +++ b/test/integration/oracle-7/bats/verify_oracle-7.bats @@ -7,3 +7,8 @@ run test -d $JAVA_HOME [ "$status" -eq 0 ] } + +@test "properly links jar" { + run test -L /usr/bin/jar + [ "$status" -eq 0 ] +} diff --git a/test/integration/oracle/bats/verify_oracle.bats b/test/integration/oracle/bats/verify_oracle.bats index 32432388..a617a032 100644 --- a/test/integration/oracle/bats/verify_oracle.bats +++ b/test/integration/oracle/bats/verify_oracle.bats @@ -7,3 +7,8 @@ run test -d $JAVA_HOME [ "$status" -eq 0 ] } + +@test "properly links jar" { + run test -L /usr/bin/jar + [ "$status" -eq 0 ] +}