Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chef generate generator flow is quite broken #262

Open
jaymzh opened this issue Feb 4, 2025 · 4 comments
Open

chef generate generator flow is quite broken #262

jaymzh opened this issue Feb 4, 2025 · 4 comments
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@jaymzh
Copy link
Contributor

jaymzh commented Feb 4, 2025

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.

@jaymzh jaymzh added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Feb 4, 2025
@Stromweld
Copy link
Contributor

Stromweld commented Feb 4, 2025

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.

@Stromweld
Copy link
Contributor

That file is also probably poorly named.

@jaymzh
Copy link
Contributor Author

jaymzh commented Feb 4, 2025

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

@Stromweld
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants