Knife Zero Bad URI Error


#1

I’m trying to follow the chef-zero tutorial posted here:

I’m running chef 12.0.3 on windows via the chefdk installer.

The various chef-client -z commands all work exactly as described in
the document. Running chef-client -z seems to automatically create a
"nodes" directory in the current working directory with a
.json file describing the host. The "knife node list -z"
command returns the computer’s hostname. But the knife run_list add
command errors out like this:

PS> knife node run_list add -z recipe[helloworld]
WARNING: No knife configuration file found
ERROR: URI::InvalidURIError: bad URI(is not URI?):
http://localhost:8889/nodes/recipe[helloworld]

The article seems to be missing some basic information about how how
chef-client -z and knife -z interact. It appears I need to someone
make chef-client run its built-in server in the background, but I
can’t tell how to do that. chef-zero has a start_background option,
but chef-client -z does not (or at least its not documented here
https://docs.chef.io/ctl_chef_client.html). The relationship between
chef-zero and chef-client -z is also unclear.

I’m having no luck googling any of this stuff. Any hints on what basic
architectural pieces I’m not understanding would be helpful.


#2

On Thursday, April 16, 2015 at 11:01 AM, Andy Theuninck wrote:

I’m trying to follow the chef-zero tutorial posted here:
https://www.chef.io/blog/2013/10/31/chef-client-z-from-zero-to-chef-in-8-5-seconds/

I’m running chef 12.0.3 on windows via the chefdk installer.

The various chef-client -z commands all work exactly as described in
the document. Running chef-client -z seems to automatically create a
"nodes" directory in the current working directory with a
.json file describing the host. The "knife node list -z"
command returns the computer’s hostname. But the knife run_list add
command errors out like this:

PS> knife node run_list add -z recipe[helloworld]
WARNING: No knife configuration file found
ERROR: URI::InvalidURIError: bad URI(is not URI?):
http://localhost:8889/nodes/recipe[helloworld]

This looks like a bug in the run_list add command that is unrelated to chef-zero/local mode

The article seems to be missing some basic information about how how
chef-client -z and knife -z interact. It appears I need to someone
make chef-client run its built-in server in the background, but I
can’t tell how to do that. chef-zero has a start_background option,
but chef-client -z does not (or at least its not documented here
https://docs.chef.io/ctl_chef_client.html). The relationship between
chef-zero and chef-client -z is also unclear.

knife -z and chef-client -z run chef-zero in a background thread. IIRC the filesystem paths for different chef data types will be assumed to be relative to your current working directory unless you configure chef/knife otherwise. Off the top of my head, I think chef_repo_path is the option that controls this, but you should double check the docs.

I’m having no luck googling any of this stuff. Any hints on what basic
architectural pieces I’m not understanding would be helpful.

HTH,


Daniel DeLeo