Class: PoiseBoiler::Helpers::Kitchen
- Inherits:
-
Halite::HelperBase
- Object
- Halite::HelperBase
- PoiseBoiler::Helpers::Kitchen
- Defined in:
- lib/poise_boiler/helpers/kitchen.rb,
lib/poise_boiler/helpers/kitchen/provisioner.rb,
lib/poise_boiler/helpers/kitchen/policy_provisioner.rb,
lib/poise_boiler/helpers/kitchen/provisioner_helpers.rb
Overview
Helpers for Test Kitchen and .kitchen.yml configuration.
Defined Under Namespace
Modules: ProvisionerHelpers Classes: PolicyProvisioner, Provisioner
Constant Summary collapse
- PLATFORM_ALIASES =
Shorthand names for Test Kitchen platforms.
{ 'windows' => %w{windows-2012r2}, 'windows32' => %w{windows-2008sp2}, 'ubuntu' => %w{ubuntu-14.04 ubuntu-16.04}, 'rhel' => %w{centos}, 'centos' => %w{centos-6 centos-7}, 'linux' => %w{ubuntu rhel centos}, 'unix' => %w{linux}, #, freebsd}, 'all' => %w{unix windows}, 'any' => %w{ubuntu-16.04}, # For cookbooks that don't actually use platform-specific bits. }
- DEFAULT_EC2_SUBNET_ID =
Default EC2 subnet ID when not overridden in the environment or config.
'subnet-ca674af7'- DEFAULT_EC2_LEGACY_INSTANCES_SUBNET_ID =
Default EC2 subnet ID for previous-generation instance types.
'subnet-1ffec232'- DEFAULT_EC2_SECURITY_GROUP_ID =
Default EC2 security group when not overridden in the environment or config.
'sg-ed1ad892'
Instance Method Summary collapse
-
#chef_version ⇒ String?
The Chef version to use for Test Kitchen or nil for any version.
- #cookbook_name ⇒ Object
-
#initialize(**options) ⇒ Kitchen
constructor
A new instance of Kitchen.
-
#to_yaml ⇒ String
Generate YAML text for inclusion in a config file.
Constructor Details
#initialize(**options) ⇒ Kitchen
Returns a new instance of Kitchen.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/poise_boiler/helpers/kitchen.rb', line 51 def initialize(**) # Figure out the directory that contains the kitchen.yml by looking for # the first entry in the stack that isn't inside poise-boiler. [:base] ||= if caller.find {|line| !line.start_with?(File.('../../..', __FILE__)) } =~ /^(.*?):\d+:in/ File.('..', $1) else # ¯\_(ツ)_/¯ hope for the best. Dir.pwd end super(**) end |
Instance Method Details
#chef_version ⇒ String?
The Chef version to use for Test Kitchen or nil for any version.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/poise_boiler/helpers/kitchen.rb', line 73 def chef_version # SPEC_BLOCK_CI is used to force non-locking behavior inside tests. @chef_version ||= ENV['CHEF_VERSION'] || if ENV['POISE_MASTER_BUILD'] # We're going to install the latest nightly via Omnitruck later on. nil elsif ENV['SPEC_BLOCK_CI'] != 'true' # If there isn't a specific override, lock TK to use the same version of Chef as the Gemfile. require 'chef/version' Chef::VERSION.to_s end end |
#cookbook_name ⇒ Object
85 86 87 |
# File 'lib/poise_boiler/helpers/kitchen.rb', line 85 def cookbook_name [:cookbook_name] || cookbook.cookbook_name end |
#to_yaml ⇒ String
Generate YAML text for inclusion in a config file.
66 67 68 |
# File 'lib/poise_boiler/helpers/kitchen.rb', line 66 def to_yaml kitchen_config.to_yaml.gsub(/---[ \n]/, '') end |