[chef] Re: Validation Error using encrypted databags on windows

Chronological Thread 
  • From: Tyler Ball < >
  • To: Sachin Gupta < >
  • Cc: " " < >
  • Subject: [chef] Re: Validation Error using encrypted databags on windows
  • Date: Tue, 17 Feb 2015 15:01:34 -0800

Hey Sachin - I tried duplicating your steps with the latest ChefDK (0.4.0) on both Windows and OSX and was unable to duplicate it.  Are you using ChefDK or the Chef omnibus install?  In either case, can you try updating to the latest version and seeing if it is still a problem?

Can you also try running `knife data bag show credentials WinTest -z --secret-file D:\Secret_key_Win\encrypted_data_bag_secret`?  That will exercise the same code path that running your recipe does.  


Hi Tyler,

These are the steps I am executing for creating data bags on windows 

C:\Users\sachkkum\chef-repo>set RANDFILE=D:\Secret_key_Win\.rnd

C:\Users\sachkkum\chef-repo>openssl rand -base64 2048 >  D:\Secret_key_Win\encrypted_data_bag_secret

C:\Users\sachkkum\chef-repo>set EDITOR="%windir%\system32\notepad.exe"

C:\Users\sachkkum\chef-repo>knife data bag create --local-mode  credentials WinTest --secret-file D:\Secret_key_Win\encrypted_data_bag_secret
Created data_bag[credentials]
Created data_bag_item[WinTest]

C:\Users\sachkkum\chef-repo>cat data_bags\credentials\WinTest.json
  "id": "WinTest",
  "username": {
    "encrypted_data": "IvDS8Sb+ZS3Xwl5sw74/17moKk/fwnkMMeEycCTlJvY=\n",
    "iv": "UakZ8xbJtsUI+aB04nSEeg==\n",
    "version": 1,
    "cipher": "aes-256-cbc"
  "password": {
    "encrypted_data": "qKJqOTKFWeuE9HznSy+7+/KxsURHvcK3+b7CClBSB2U=\n",
    "iv": "j4cMqNGiMWzAJA8W1ssFRg==\n",
    "version": 1,
    "cipher": "aes-256-cbc"

--------- Inside the recipe I am calling load data bags function--
secret = Chef::EncryptedDataBagItem.load_secret('D:\Secret_key_Win\encrypted_data_bag_secret')
win_cred=Chef::EncryptedDataBagItem.load("credentials","WinTest", secret)

while loading I am getting error message as "FATAL: Chef::Exceptions::ValidationFailed: Data Bag Items must contain a Hash or Mash!"

attached is the chef-stractrace.out


On Tue, Feb 17, 2015 at 10:20 PM, Tyler Ball < " target="_blank" class=""> > wrote:
Hey Sachin, I would like to see the full stacktrace of that exception.  Can you enable debug logging(`-l debug`), run it again and grab the stacktrace?  You may also see a message like `Stacktrace dumped to c:/chef/cache/chef-stacktrace.out` showing where the stacktrace is stored.


Hi Julian,

I changed the data_bag_path  
data_bag_path  "C:\\Users\\sachkkum\\chef-repo\\data_bags" or data_bag_path  'C:\Users\sachkkum\chef-repo\data_bags'
 but still the same error 

Data Bag Items must contain a Hash or Mash!


On Mon, Feb 16, 2015 at 11:32 PM, Julian C. Dunn < " target="_blank" class=""> > wrote:
On Mon, Feb 16, 2015 at 2:53 AM, Sachin Gupta
< " target="_blank" class=""> > wrote:

>  In my solo.rb, I had made these entries
> data_bag_path root 'C:\chef-repo\data_bags'

Is that literally what it says? What is "root"?

- Julian

[ Julian C. Dunn < " target="_blank" class=""> >          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ]
[ gopher://sdf.org/1/users/keymaker/           * compliant!    ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]


Archive powered by MHonArc 2.6.16.