Skip to content

Commit 278518a

Browse files
committed
chefctl: fix a hard-coded path
This adds a configuration for `chef_config_dir` where we can look for the prod cert link rather than assuming `/etc/chef` - so that those using cinc can use chefctl more easily. The default is, of course `/etc/chef` so nothing will change for anyone not specifying this config. Side note, what I really wanted to do was create a `client_distro`, and then build the defaults based on _that_, but to allow people to still be able to overwrite _that_ requires significant refactoring, using the new `default(..)` syntax for mixlib-config and then creating a method for most of the configs, and that seemed like too much change for something so small, so I did not. Signed-off-by: Phil Dibowitz <phil@ipom.com>
1 parent f306454 commit 278518a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

chefctl/src/chefctl.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ module Config
170170
# See Chefctl::Plugin.rerun_chef?
171171
max_retries 1
172172

173+
# where to find certs and configs
174+
client_config_dir "/etc/chef"
175+
173176
# The testing timestamp.
174177
# See https://github.com/facebook/taste-tester
175178
testing_timestamp '/etc/chef/test_timestamp'
@@ -249,7 +252,7 @@ def hostname
249252
# them if necessary.
250253
# The return value is ignored.
251254
def generate_certs
252-
client_prod_cert = '/etc/chef/client-prod.pem'
255+
client_prod_cert = "#{Chefctl::Config.client_config_dir}/client-prod.pem"
253256
if File.zero?(client_prod_cert)
254257
Chefctl.logger.info('zero-byte client pem found, removing')
255258
File.unlink(client_prod_cert)

0 commit comments

Comments
 (0)