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

Creating new data bag item and putting it on the server #960

Open
SwatiSuwalka opened this issue May 15, 2019 · 0 comments
Open

Creating new data bag item and putting it on the server #960

SwatiSuwalka opened this issue May 15, 2019 · 0 comments

Comments

@SwatiSuwalka
Copy link

Hey I am trying to update some data bag(on the server) in my recipe using this code :-

celerybeat_host = Chef::DataBagItem.new
celerybeat_host.data_bag('paas_status')
celerybeat_host.raw_data = {
'id' => 'workers_celerybeat-dev',
'fqdn' => node.name,
'updated' => Time.new.to_i
}
celerybeat_host.save

Could you please tell what should I mock for this situation as I am facing this error :-

Connection refused connecting to https://localhost/data/paas_status/workers_celerybeat-dev, giving up

I tried this -

@data_bag_item = Chef::DataBagItem.new do |dbi|
allow(dbi).to receive(:save).and_return(true)
end

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

1 participant