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

raw_json property of chef_data_bag_item is not used #191

Open
gscho opened this issue Apr 6, 2021 · 0 comments
Open

raw_json property of chef_data_bag_item is not used #191

gscho opened this issue Apr 6, 2021 · 0 comments
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@gscho
Copy link

gscho commented Apr 6, 2021

Description

The raw_json property of the chef_data_bag_item resource is not used/respected when creating a data bag item

Chef Version

v16.11.7

Platform Version

Ubuntu-20.04

Replication Case

The following recipe can be used to replicate the issue.

my_data_bag_item = {}
my_data_bag_item['id'] = 'adam'
my_data_bag_item['real_name'] = 'Adam Brent Jacob'

chef_data_bag_item 'my_data_bag/adam' do
  raw_json my_data_bag_item
  action :create
  compile_time true
end

example = data_bag_item('my_data_bag', 'adam')

log example.inspect

Client Output

As you can see, the data bag only contains an id which itself is computed from the name of the resource. Nothing provided via raw_json gets added to the data bag.

-----> Starting Test Kitchen (v2.10.0)
-----> Converging <default-ubuntu-2004>...
       Preparing files for transfer
       Installing cookbooks for Policyfile /Users/gschofield/Workspace/progress/web_server/Policyfile.rb using `chef install`
       Installing cookbooks from lock
       Installing web_server 0.1.3
       Preparing dna.json
       Exporting cookbook dependencies from Policyfile /var/folders/s5/1w2wn2cs3v12x1pjv09gky8h0000gn/T/default-ubuntu-2004-sandbox-20210406-59850-mjt40t...
       Exported policy 'web_server' to /var/folders/s5/1w2wn2cs3v12x1pjv09gky8h0000gn/T/default-ubuntu-2004-sandbox-20210406-59850-mjt40t

       To converge this system with the exported policy, run:
         cd /var/folders/s5/1w2wn2cs3v12x1pjv09gky8h0000gn/T/default-ubuntu-2004-sandbox-20210406-59850-mjt40t
         chef-client -z
       Removing non-cookbook files before transfer
       Preparing data_bags
       Preparing validation.pem
       Preparing client.rb
       chef installation detected
       install_strategy set to 'once'
       Nothing to install
       Transferring files to <default-ubuntu-2004>
       Starting Chef Infra Client, version 16.11.7
       Patents: https://www.chef.io/patents
       Using policy 'web_server' at revision 'c66cf3e426227ae1bb20fef2f4dba2ab656d52aa2f0fa8d992c688120dc2df2c'
       resolving cookbooks for run list: ["web_server::default@0.1.3 (58cfa44)"]
       Synchronizing Cookbooks:
         - web_server (0.1.3)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       Recipe: web_server::default
         * chef_data_bag_item[my_data_bag/adam] action create
           - create data bag item adam at chefzero://localhost:1
         Converging 2 resources
         * chef_data_bag_item[my_data_bag/adam] action nothing (skipped due to action :nothing)
         * log[data_bag_item["my_data_bag", "adam", {"id"=>"adam"}]] action write

       Running handlers:
       Running handlers complete
       Chef Infra Client finished, 1/3 resources updated in 01 seconds
       Downloading files from <default-ubuntu-2004>
       Finished converging <default-ubuntu-2004> (0m5.76s).
@gscho gscho added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

1 participant