From 000802f02a5c52c32cd4cc1b5ee24bf57d21f3ab Mon Sep 17 00:00:00 2001 From: "Eric G. Wolfe" Date: Wed, 4 Feb 2015 18:43:14 -0500 Subject: [PATCH] Revert #38 This previous change worked around a bug in Knife that limited use of characters in data bags. See [CHEF-3531](https://github.com/chef/chef/pull/1104) for more information. This reverts commit 7b091cfe039da729926d12a4e31da2db6aceb007. Conflicts: providers/manage.rb spec/default_spec.rb --- CHANGELOG.md | 10 ++++++++++ README.md | 6 +++--- providers/manage.rb | 1 - resources/manage.rb | 2 +- spec/default_spec.rb | 5 +++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 740ca95..58b75d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ certificate cookbook changelog ============================== +v0.8.0 +------ + +Revert #38 + +This previous change worked around a bug in Knife that limited use of characters +in data bags. See [CHEF-3531](https://github.com/chef/chef/pull/1104) for more information. + +This reverts commit 7b091cfe039da729926d12a4e31da2db6aceb007. + v0.7.0 ------ diff --git a/README.md b/README.md index 7935d52..f640467 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ Into this: Finally, you'll want to create the data bag object to contain your certs, keys, and optionally your CA root chain bundle. The default recipe uses -the OHAI attribute *hostname* as a *search_id*. With version 0.7.0, and newer, -one can use an *fqdn* as the *search_id*, the library will normalize dots into -underscores. +the OHAI attribute *hostname* as a *search_id*. One can use an *fqdn* as the *search_id*. +Older versions of Knife have a strict character filter list which prevents the use of `.` +separators in data bag IDs. The cookbook also contains an example *wildcard* recipe to use with wildcard certificates (\*.example.com) certificates. diff --git a/providers/manage.rb b/providers/manage.rb index 8c0ffe2..79a262f 100644 --- a/providers/manage.rb +++ b/providers/manage.rb @@ -24,7 +24,6 @@ def whyrun_supported? use_inline_resources if defined?(use_inline_resources) action :create do - search_id = new_resource.search_id.gsub('.', '_') ssl_secret = Chef::EncryptedDataBagItem.load_secret(new_resource.data_bag_secret) ssl_item = begin diff --git a/resources/manage.rb b/resources/manage.rb index ffbcd40..4a4d813 100644 --- a/resources/manage.rb +++ b/resources/manage.rb @@ -32,7 +32,7 @@ def initialize(*args) attribute :search_id, :kind_of => String, :name_attribute => true attribute :ignore_missing, :kind_of => [TrueClass, FalseClass], :default => false -# :ngnix_cert is a PEM which combine host cert and CA trust chain for nginx. +# :nginx_cert is a PEM which combine host cert and CA trust chain for nginx. # :combined_file is a PEM which combine certs and keys in one file, for things such as haproxy. # :cert_file is the filename for the managed certificate. # :key_file is the filename for the managed key. diff --git a/spec/default_spec.rb b/spec/default_spec.rb index b0227e9..ed661c2 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -14,9 +14,10 @@ end.converge(described_recipe) end - it 'Replace dots with underscore in item name to search' do + # This was a bug in Knife, see CHEF-3531 + it '[Issue #38] does not normalize dots in hostnames' do allow(Chef::EncryptedDataBagItem).to receive(:load) - .with('certificates', 'example_com', @secret) + .with('certificates', 'example.com', @secret) .and_return(@data_bag_item_content) expect(chef_run).to create_certificate_manage('example.com') end