Skip to content

Chef Generate ignores config.rb options placed in credentials file #190

@qubitrenegade

Description

@qubitrenegade

Version:

Chef Workstation version: 21.8.555
Chef Infra Client version: 17.3.48
Chef InSpec version: 4.38.9
Chef CLI version: 5.4.1
Chef Habitat version: 1.6.351
Test Kitchen version: 3.0.0
Cookstyle version: 7.15.4

Environment:

Confirmed on Ubuntu and Fedora

Scenario:

The docs seem to imply the credentials file is the new way of doing things: https://docs.chef.io/workstation/knife_setup

"Previous Chef Infra setups recommended setting up knife with a config.rb file."

The docs also seem to suggest that any config.rb values are valid in the credentials file (emphasis mine):

"Set up knife profiles by adding them to the .chef/credentials file in your home directory on your workstation. The credentials file is TOML formatted. Each profile is listed as a separate ‘table’ name of your choice, and is followed by key = value pairs. The keys correspond to any setting permitted in the config.rb file."

However, this does not seem to work...

Steps to Reproduce:

Create ~/.chef/credentials file

[default]
client_name     = 'foo'
client_key      = '/home/foo/.chef/foo.pem'
chef_server_url = 'https://foo.ec2.internal/organizations/myorg'
cookbook_email  = 'foo [at] gmail.com'
cookbook_license = 'apachev2'
cookbook_copyright = 'foo'

Generate cookbook

chef generate cookbook foo

Find default info in metadata:

$ grep maintainerffoo/metadata.rb 
maintainer 'The Authors'
maintainer_email '[email protected]'
$ grep license foo/metadata.rb 
license 'All Rights Reserved'

Expected Result:

license, maintainer, and maintainer_email should be replaced.

Actual Result:

Default information still in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage: ConfirmedIndicates and issue has been confirmed as described.Type: BugDoes not work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions