Allowed Characters in a Chef's Cookbook with LWRP
I have an LWRP resource defined in my Cookbook - as described at http://docs.getchef.com/chef/lwrps_custom.html#file-locations
So, let's assume my cookbook name is some name, so I have the files (as you can guess, this LWRP is based on the https://github.com/sethvargo-cookbooks/users code):
./some-name/recipes/default.rb
./some-name/recipes/some-kind.rb
./some-name/providers/manage.rb
./some-name/resources/manage.rb
File contents. / some -name / recipes / some-kind.rb:
some-name_manage "some-kind" do
data_bag "some-kind"
end
While calling the nightly cookbook some name load I get:
FATAL: Cookbook file recipes/some-kind.rb has a ruby syntax error:
FATAL: /path/to/chef-repo/cookbooks/some-name/recipes/some-kind.rb:2: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
FATAL: some-name_manage "some-kind" do
FATAL: ^
FATAL: /path/to/chef-repo/cookbooks/some-name/recipes/some-kind.rb:2: syntax error, unexpected keyword_do, expecting keyword_end
FATAL: /path/to/chef-repo/cookbooks/some-name/recipes/some-kind.rb:8: syntax error, unexpected keyword_end, expecting $end
The problem is my cookbook contains a dash ("-") character. If I haven't put a dash in the cookbook, then everything will be fine.
So the question is, is there a way to use the dash character in the cookbook name when you want to use LWRP? Some kind of escape?
+3
source to share