Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't "knife upload roles" upload any roles?

I followed the OpsCode quickstart guide and things went fairly smoothly, but now I'm running into issues experimenting with roles. I have a "starter" role in my repo that was provided by OpsCode. When I follow the first official documentation I could find and run the following from the top of my chef repo:

knife upload roles

it simply returns and nothing happens. I get no role (new or updated) on my chef server. The following line does work for creation and updating:

knife role from file .\roles\starter.rb

but I find it overly cumbersome and I would prefer something that just pushes my entire repo up to the server (or at least all of the roles) to make me more confident that everything is up to date.

like image 731
Josh Gagnon Avatar asked Aug 15 '13 20:08

Josh Gagnon


People also ask

Which of the following commands can we use to create and uploaded cookbooks with knife?

Berkshelf command is similar to knife command and helps to upload cookbooks to Chef Server.

What is the command used to upload a cookbook to the Chef server?

The following “knife cookbook upload” command will upload the cookbook that we created above to the Chef server. As we see, since this is the first version of this cookbook, it is showing the version number as 0.1. 0. # knife cookbook upload thegeekstuff Uploading thegeekstuff [0.1.

What is a knife in chef?

: a knife used for preparing food especially : a large, general-purpose kitchen knife usually 8 to 10 inches long that has a blade curving upward along its length and ending in a narrow point The chef's knife, usually 8 inches long, is … the workhorse of the kitchen.


2 Answers

Yeah, in this case Chef is a little bit inconsistent. I use the next 3 lines to push by whole repo to chef-server (of course after the tests have passed):

knife cookbook upload --all
knife role from file roles/*.rb
knife data bag from file --all
like image 166
Draco Ater Avatar answered Sep 27 '22 22:09

Draco Ater


knife upload is based on the previous knife-essentials gem (now merged in chef under the name chef_fs).

https://github.com/opscode/chef/issues/1641 (and https://github.com/jkeiser/knife-essentials/issues/67) describe the issue: knife upload only support .json files for roles.

That's why your command knife upload does not output anything.

If you want to use knife upload, you have to convert all roles to json first (https://gist.github.com/red56/834890 for an example)

like image 39
kamaradclimber Avatar answered Sep 28 '22 00:09

kamaradclimber