Search code examples
chef-infraknife

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.


Solution

  • 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