summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTyler Ball <tyler-ball@users.noreply.github.com>2017-02-23 12:41:25 -0600
committertyler-ball <tyleraball@gmail.com>2017-02-23 12:52:33 -0600
commit9a066eece59dfd146d8b72c970a7189b65004a5f (patch)
tree6345ab07e6608d70e6b4fcca943a512dee0fb3c3 /lib
parent42445a55fe97a4c8c1b5b88b91b38e3f15babc61 (diff)
downloadchef-er-478/fips_bootstrap.tar.gz
Require chef/version when trying to read iter-478/fips_bootstrap
When a node is bootstrapped in FIPS mode and then tries to run a chef-client run it gets the following error: ``` STDERR: /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-config-12.18.31/lib/chef-config/workstation_config_loader.rb:163:in `rescue in apply_config': You have an error in your config file /var/opt/delivery/workspace/.chef/knife.rb (ChefConfig::ConfigurationError) NameError: uninitialized constant Chef /var/opt/delivery/workspace/.chef/knife.rb:2:in `eval' /var/opt/delivery/workspace/.chef/knife.rb:2:in `eval' /var/opt/delivery/workspace/.chef/knife.rb:2:in `from_string' ``` Signed-off-by: tyler-ball <tyleraball@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index ceb067d48d..c395ebcfa0 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -161,13 +161,14 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
end
if Chef::Config[:fips]
- client_rb << <<-CONFIG
-fips true
-chef_version = ::Chef::VERSION.split(".")
-unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 8)
- raise "FIPS Mode requested but not supported by this client"
-end
-CONFIG
+ client_rb << <<-CONFIG.gsub(/^ {14}/, "")
+ fips true
+ require "chef/version"
+ chef_version = ::Chef::VERSION.split(".")
+ unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 8)
+ raise "FIPS Mode requested but not supported by this client"
+ end
+ CONFIG
end
client_rb