Class: Chef::Context
- Inherits:
-
Object
- Object
- Chef::Context
- Defined in:
- lib/chef/context.rb
Constant Summary collapse
- KITCHEN_CONTEXT_ENV_NAME =
"IS_KITCHEN".freeze
Class Method Summary collapse
-
.switch_to_workstation_entitlement ⇒ Object
This method will switch the license entitlement to Chef Workstation entitlement.
-
.test_kitchen_context? ⇒ Boolean
When chef-test-kitchen-enterprise invokes the chef-client during the converge phase, it sets the env variable IS_KITCHEN to true.
Class Method Details
.switch_to_workstation_entitlement ⇒ Object
This method will switch the license entitlement to Chef Workstation entitlement.
33 34 35 36 37 38 39 |
# File 'lib/chef/context.rb', line 33 def switch_to_workstation_entitlement puts "Running under Test-Kitchen: Switching License to Chef Workstation entitlement!" ChefLicensing.configure do |config| # Reset entitlement ID to the ID of Chef Workstation config.chef_entitlement_id = Chef::LicensingConfig::WORKSTATION_ENTITLEMENT_ID end end |
.test_kitchen_context? ⇒ Boolean
When chef-test-kitchen-enterprise invokes the chef-client during the converge phase, it sets the env variable IS_KITCHEN to true. This method checks the existence of the ENV variable and returns if the chef-client is running in the test-kitchen context.
28 29 30 |
# File 'lib/chef/context.rb', line 28 def test_kitchen_context? @context ||= (fetch_env_value == "true") end |