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

Cannot search encrypted data bags #70

Open
halida opened this issue Mar 31, 2015 · 1 comment
Open

Cannot search encrypted data bags #70

halida opened this issue Mar 31, 2015 · 1 comment

Comments

@halida
Copy link

halida commented Mar 31, 2015

In this code:
https://github.com/edelight/chef-solo-search/blob/master/libraries/search/parser.rb#L107

item could be a EncryptedDataBagItem, which don't have a keys method:
http://www.rubydoc.info/gems/chef/0.10.4/Chef/EncryptedDataBagItem

Then I cannot use it to search encrypted data bags, how can I fix it?

Error message:

Relevant File Content:
----------------------
/tmp/chef-solo/berks-cookbooks/chef-solo-search/libraries/search/parser.rb:

100:    class FieldName < Treetop::Runtime::SyntaxNode
101:      def match( item )
102:        if self.text_value.count("_") > 0
103:          item.merge!(build_flat_hash(item))
104:        end
105:        if self.text_value.end_with?("*")
106:          part = self.text_value.chomp("*")
107>>         item.keys.collect{ |key| key.start_with?(part)? key: nil}.compact
108:        else
109:          if item.has_key?(self.text_value)
110:            [self.text_value,]
111:          else
112:            nil
113:          end
114:        end
115:      end
116:    end

[2015-03-31T20:23:59+08:00] DEBUG: Re-raising exception: NoMethodError - undefined method `keys' for #<Chef::EncryptedDataBagItem:0x00000003fc2198>
/tmp/chef-solo/berks-cookbooks/chef-solo-search/libraries/search/parser.rb:107:in `match'
@jzubielik
Copy link

I had the same issue. Please check #71.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants