[chef] Validation Error using encrypted databags on windows


Chronological Thread 
  • From: Sachin Gupta < >
  • To: " " < >
  • Cc: sachin kumar < >
  • Subject: [chef] Validation Error using encrypted databags on windows
  • Date: Mon, 16 Feb 2015 13:23:18 +0530

Hi All,

 I am using encrypted data bag on windows.

 In my solo.rb, I had made these entries

data_bag_path root 'C:\chef-repo\data_bags'
encrypted_data_bag_secret 'E:\Sachin\my_data_bag_key'

 I double checked, I am having my encrypted key on  E:\Sachin.

created a databag named windows having credentials as username and password.


entries in my windows/credentials.json

{
  "id": "credentials",
  "username": {
    "encrypted_data": "5JEQV4Fe7Xojldh03xN8oeqvN2amvvmqzoojkBIqV5d9wAx6OS2itYVkWT6w\nTCUh\n",
    "iv": "/SBoqVHMlO/+YbM9tPOMRg==\n",
    "version": 1,
    "cipher": "aes-256-cbc"
  },
  "password": {
    "encrypted_data": "OPAARmUYZLPslr3j4stSR06AYYP53yqJLvhfnChV56I=\n",
    "iv": "1IXCHxI2AgCLSlQFPmrpqg==\n",
    "version": 1,
    "cipher": "aes-256-cbc"
  }
}

when I am executing load databag from a recipe as
win_cred=Chef::EncryptedDataBagItem.load("windows", "credentials")

win_username=win_cred["username"]
win_passwd=win_cred["password"]

getting error as " FATAL: Chef::Exceptions::ValidationFailed:Data Bag Items must contain a Hash or Mash! "

Can someone help, where I am doing wrong and why getting validation error during chef run.


Thanks & Regards,
Sachin Gupta



Archive powered by MHonArc 2.6.16.

§