Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newest version 2.0.1 do not parse the data_bag name correctly #98

Closed
afiune opened this issue Feb 9, 2016 · 1 comment
Closed

Newest version 2.0.1 do not parse the data_bag name correctly #98

afiune opened this issue Feb 9, 2016 · 1 comment
Assignees
Labels
Type: Bug Does not work as expected.

Comments

@afiune
Copy link

afiune commented Feb 9, 2016

Debugging a little bit I have discovered that the new_resource.data_bag has a wrong value. I am calling the resource:

     45: chef_data_bag_item 'keys/delivery_builder_keys' do
     46:   raw_data { DATA }
     47:   action :create
     48: end

And the result is this:

[5] pry(#<Chef::Resource::ChefDataBagItem action provider>)> Chef::Cheffish::VERSION
(pry):5: warning: toplevel constant Cheffish referenced by Chef::Cheffish
=> "2.0.1"
[6] pry(#<Chef::Resource::ChefDataBagItem action provider>)> new_resource.name
=> "keys/delivery_builder_keys"
[7] pry(#<Chef::Resource::ChefDataBagItem action provider>)> new_resource.data_bag
=> "k"
[8] pry(#<Chef::Resource::ChefDataBagItem action provider>)> new_resource.id
=> "delivery_builder_keys"
@afiune
Copy link
Author

afiune commented Feb 9, 2016

Found the problem! This makes me 😢

https://github.com/chef/cheffish/blob/master/lib/chef/resource/chef_data_bag_item.rb#L32,L35

property :data_bag, String, default: lazy {
    split = name.split('/', 2)[0]
    split.size >= 2 ? split[0] : nil
}

Debugging this:

[17] pry(#<Chef::Resource::ChefDataBagItem>)> name
=> "keys/delivery_builder_keys"
[18] pry(#<Chef::Resource::ChefDataBagItem>)> split = name.split('/', 2)[0]
=> "keys"
[19] pry(#<Chef::Resource::ChefDataBagItem>)> split.size >= 2 ? split[0] : nil
=> "k"
[20] pry(#<Chef::Resource::ChefDataBagItem>)>

@afiune afiune added the Bug label Feb 9, 2016
afiune pushed a commit that referenced this issue Feb 9, 2016
@tyler-ball tyler-ball changed the title Newest version 2.0.1 do not parse the data_bag name correctly Newest version 2.0.1 do not parse the data_bag name correctly Feb 9, 2016
@thommay thommay added Type: Bug Does not work as expected. and removed Bug labels Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

3 participants