Skip to content

Commit 789040f

Browse files
committed
Fixed bug in pattern match where cert comapanyenterpriserootca2 is incorrectly matched to Alias name: comapanyenterpriserootca2.1. Add option to match whitespace and end of line to fix issue
1 parent d6c7e01 commit 789040f

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This file is used to list changes made in each version of the Java cookbook.
44

55
## Unreleased
6+
- Fixed java_certificate pattern match for if cert exists.
67

78
## 4.3.0 (2019-08-04)
89

resources/certificate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
Chef::Log.debug(cmd.format_for_exception)
5757
Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless cmd.exitstatus == 0
5858

59-
has_key = !cmd.stdout[/Alias name: \b#{certalias}/i].nil?
59+
has_key = !cmd.stdout[/Alias name: \b#{certalias}\s*$/i].nil?
6060

6161
if has_key
6262
converge_by("delete existing certificate #{certalias} from #{truststore}") do

0 commit comments

Comments
 (0)