Create databag by chef-solo


#1

Ohai, chefs!

I’m running the following:

cluster= Chef::DataBag.new
cluster.name http://legs.name("#{current}-cluster")
cluster.create

to create the databag as a preparatory step.

When testes via kitchen, I get an error

   I cannot read /tmp/kitchen/client.pem, which you told me to use to

sign requests!

Thanks,

Greg


#2

You should use chef-client -z instead of chef-solo. The chef core data
bag libraries assumes it is talking to a server, and does not know how
to create data bags on the filesystem under chef-solo. Chef-client -z
fires up a minimal chef server API in the background so that you get a
chef-solo-like local interface but all the APIs in core chef which
expect to talk to a server can talk to a server.

On 3/5/15 7:08 AM, gregory grey wrote:

Ohai, chefs!

I’m running the following:

cluster= Chef::DataBag.new
cluster.name http://legs.name("#{current}-cluster")
cluster.create

to create the databag as a preparatory step.

When testes via kitchen, I get an error

   I cannot read /tmp/kitchen/client.pem, which you told me to use 

to sign requests!

Thanks,

Greg


#3

Hi, when I run kitchen with chef-zero as a provisioner, I get error:

   NoMethodError
   -------------
   No resource or method named `setupcluster' for `Chef::Recipe

“default”’

    >>>setupcluster "target" do
          action :prepare
    end

…which was not there when I was testing it via chef-solo.

Is there some alterations to be made?

setupcluster is LWPR, defined in resources/setupcluster.rb and
providers/setupcluster.rb

Thanks,

Greg

2015-03-05 20:19 GMT+01:00 Lamont Granquist lamont@chef.io:

You should use chef-client -z instead of chef-solo. The chef core data
bag libraries assumes it is talking to a server, and does not know how to
create data bags on the filesystem under chef-solo. Chef-client -z fires up
a minimal chef server API in the background so that you get a
chef-solo-like local interface but all the APIs in core chef which expect
to talk to a server can talk to a server.

On 3/5/15 7:08 AM, gregory grey wrote:

Ohai, chefs!

I’m running the following:

cluster= Chef::DataBag.new
cluster.name http://legs.name("#{current}-cluster")
cluster.create

to create the databag as a preparatory step.

When testes via kitchen, I get an error

   I cannot read /tmp/kitchen/client.pem, which you told me to use to

sign requests!

Thanks,

Greg


#4

If it is a LWRP I believe you need to reference it as <cookbook name>_setupcluster (unless you are using the provides syntax).

-T

On Mar 6, 2015, at 1:37 AM, gregory grey ror6ax@gmail.com wrote:

Hi, when I run kitchen with chef-zero as a provisioner, I get error:

   NoMethodError
   -------------
   No resource or method named `setupcluster' for `Chef::Recipe "default"'

    >>>setupcluster "target" do
          action :prepare
    end

…which was not there when I was testing it via chef-solo.

Is there some alterations to be made?

setupcluster is LWPR, defined in resources/setupcluster.rb and providers/setupcluster.rb

Thanks,

Greg

2015-03-05 20:19 GMT+01:00 Lamont Granquist <lamont@chef.io mailto:lamont@chef.io>:

You should use chef-client -z instead of chef-solo. The chef core data bag libraries assumes it is talking to a server, and does not know how to create data bags on the filesystem under chef-solo. Chef-client -z fires up a minimal chef server API in the background so that you get a chef-solo-like local interface but all the APIs in core chef which expect to talk to a server can talk to a server.

On 3/5/15 7:08 AM, gregory grey wrote:
Ohai, chefs!

I’m running the following:

cluster= Chef::DataBag.new
cluster.name http://cluster.name/ <http://legs.name http://legs.name/>("#{current}-cluster")
cluster.create

to create the databag as a preparatory step.

When testes via kitchen, I get an error

   I cannot read /tmp/kitchen/client.pem, which you told me to use to sign requests!

Thanks,

Greg