`chef generate generator` flow is quite broken
Version:
$ chef -v
Redirecting to cinc
Cinc Workstation version: 24.12.1073
Cinc Client version: 18.6.2
Cinc Auditor version: 5.22.65
Cinc CLI version: 5.6.16
Biome version: 1.6.821
Test Kitchen version: 3.6.0
Cookstyle version: 7.32.8
Environment:
Debian Linux sid
Scenario:
When you run chef generate generator, it tells you:
Add the following to your config file to enable it:
chefcli.generator_cookbook "/tmp/f/code_generator"
But this syntax is actually invalid:
When loading '/home/phil/.cinc-workstation/config.toml',
the following error occurred:
parse error on value "." (".")
OK, so first problem is that the tool gives you invalid syntax.
So, lets fix it to be as the docs recommend:
[chefcli]
generator_cookbook = "/tmp/f/code_generator"
That passes syntax checking, but it also doesn't seem to do anything. From here if you run:
chef generate cookbook test
it uses the internal cookbook, not the custom one. One must run:
chef generate cookbook test -f /tmp/f/code_generator
in order for it to take effect.
Steps to Reproduce:
See above.
Expected Result:
config is taken into account
Actual Result:
config is not taken into account.
when it refers to config file it's referring to the ~/.chef/config.rb which is what knife.rb was renamed to. Chef-cli and knife cli commands use that config file for the user configs for chef-server url etc.... The error could be updated to better clarify that. The ~/.chef-workstation directory is used for caching files and other things that are safe to delete. The config.toml in there is only used to persist the acceptance of the Eula license.
That file is also probably poorly named.
@Stromweld - the documentation disagrees with you: https://docs.chef.io/workstation/config/:
Chef Workstation looks for the config.toml in a default location.
Windows
Powershell: $env:USERPROFILE\.chef-workstation\config.toml
cmd.exe: %USERPROFILE%\.chef-workstation\config.toml
Linux and Mac
/home/$USER/.chef-workstation/config.toml
Regardless, I jammed that in my .chef/config.rb and .cinc/config.rb
chefcli.generator_cookbook = "/tmp/f/code_generator"
And it still does not take effect.
you are correct, it's been years since I used that and was mistaken on which config file it should go in. I looked back at on old config file I had from a previous life when I used a custom generator and found the setting in the ~/.chef-workstation/config.toml.