Skip to content

Commit 0a79708

Browse files
jaymzhfacebook-github-bot
authored andcommitted
chefctl: fix a hard-coded path (#91)
Summary: 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. Also: gem file update is to fix tests - rubocopy fails to run without base64 installed: ``` /opt/hostedtoolcache/Ruby/3.4.1/x64/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require': cannot load such file -- base64 (LoadError) ``` 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> Pull Request resolved: #91 Differential Revision: D69120467 fbshipit-source-id: 08f656434e33df4be5dc3cfbb1d461357ab07ce8
1 parent f306454 commit 0a79708

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
source 'https://rubygems.org'
2+
gem 'base64'
23
gem 'rubocop', '= 1.25.1'

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)