sous-chefs / java

Development repository for the java cookbook
https://supermarket.chef.io/cookbooks/java
Apache License 2.0
386 stars 637 forks source link

java_certificate fails when java_home path contains spaces #585

Closed decoyjoe closed 4 years ago

decoyjoe commented 4 years ago

:ghost: Brief Description

java_certificate resource fails when node['java']['java_home'] or the java_home property contain spaces.

:pancakes: Cookbook version

4.3.0

:woman_cook: Chef-Infra Version

14.14.29

:tophat: Platform details

Windows Server 2012 R2

Steps To Reproduce

Steps to reproduce the behavior:

Given an existing OpenJDK installation at a path that contains spaces, e.g. C:\Program Files\OpenJDK\jdk-11.0.5+10-jre

Define a java_certificate resource with a java_home path value that contains spaces:

java_certificate 'myrootca' do
  cert_data cert
  java_home 'C:/Program Files/OpenJDK/jdk-11.0.5+10-jre'
  keystore_path java_cacerts_path
end

Then it fails on converge:

    * java_certificate[myrootca] action install[2020-01-15T00:10:04+00:00] INFO: Processing java_certificate[myrootca] action install
[2020-01-15T00:10:04+00:00] DEBUG: ---- Begin output of C:/Program Files/OpenJDK/jdk-11.0.5+10-jre/bin/keytool -list -keystore C:\Program Files\OpenJDK\jdk-11.0.5+10-jre/lib/security/cacerts -storepass changeit -v ----
STDOUT:
STDERR: 'C:/Program' is not recognized as an internal or external command, operable program or batch file.
---- End output ...

Resource will converge successfully when changing java_home to a path without spaces, e.g. C:/OpenJDK/jdk-11.0.5+10-jre

:police_car: Expected behavior

java_certificate does not fail when node['java']['java_home'] or java_home property contain spaces in the path.

damacus commented 4 years ago

Closing due to inactivity.

If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help!

Thanks, Sous-Chefs