Encrypt data bag from inside of ruby without relying on knife
问题 At the moment to encrypt a data bag, I have to do : system "knife data bag from file TemporaryEncrypting \"#{enc_file_path}\" --secret-file #{Secret_Key_Path}" and that doesn't work because knife can't find a config file and I can't seem to get it read the one in C:\chef . How do I do this from within ruby? 回答1: I worked out how to encrypt inside of ruby, just use this code: require 'chef/knife' #require 'chef/encrypted_data_bag_item' #you need to do this in chef version 12, they've moved it