Search code examples
chef-infrarolesknifecookbook

Unable to delete a Chef role with "." in its name


I had uploaded a wrong role (rrb_v10.0.0.1) by mistake to Chef Server.

knife role list
rrb_v10.0.0.1
rrb_v10

When I try to delete this role, I get the following error

knife role delete rrb_v10.0.0.1
ERROR: Chef::Exceptions::ValidationFailed: Option name's value rrb_v10.0.0.1 does not match regular expression /^[\-[:alnum:]_]+$/

I tried to log in to Chef Manage console but its unable to show any role in the console UI. I also tried to prefix every dot with \ but that didn't work. Please provide your advise on the same.


Solution

  • Run this:

    knife exec -E 'api.delete("/roles/rrb_v10.0.0.1")'

    Will bypass all the client-side validations.