March 22, 2017

Why doesn’t `knife upload roles` upload any roles?

Josh Gagnon’s Question:

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 .rolesstarter.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.

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

Suggested solution from Draco, didn’t work for me to upload the data_bags. Here is what I did.

knife cookbook upload --all
knife role from file roles/*.rb
knife upload data_bags/

...

Please fill the form - I will response as fast as I can!