Skip to content

Commit

Permalink
Revert #38
Browse files Browse the repository at this point in the history
This previous change worked around a bug in Knife that limited use of characters
in data bags.  See [CHEF-3531](chef/chef#1104) for more information.

This reverts commit 7b091cf.

Conflicts:
	providers/manage.rb
	spec/default_spec.rb
  • Loading branch information
atomic-penguin committed Feb 4, 2015
1 parent ecd6330 commit 000802f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
------

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion providers/manage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@rmoriz

rmoriz Feb 5, 2015

Contributor

IMHO

87f4588#diff-65fcf385b2fc889af542a4ac5b2d14d1L30

needs to be reverted, too.

           ================================================================================
           Error executing action `create` on resource 'certificate_manage[xxxxx-website]'
           ================================================================================

           NameError
           ---------
           No resource, method, or local variable named `search_id' for `Chef::Provider::CertificateManage ""'

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cookbooks/certificate/providers/manage.rb:30:in `block in class_from_file'
ssl_item =
begin
Expand Down
2 changes: 1 addition & 1 deletion resources/manage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 000802f

Please sign in to comment.