Class: PoiseBoiler::Helpers::Kitchen::PolicyProvisioner

Inherits:
Object
  • Object
show all
Includes:
ProvisionerHelpers
Defined in:
lib/poise_boiler/helpers/kitchen/policy_provisioner.rb

Overview

Since:

  • 1.7.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.name ⇒ Object

Override the default value from the base class. default_config :policyfile, '.kitchen/poise_policy.rb' expand_path_for :policyfile

Since:

  • 1.7.0



42
43
44
# File 'lib/poise_boiler/helpers/kitchen/policy_provisioner.rb', line 42

def self.name
  'PoisePolicyfileZero'
end

Instance Method Details

#cleanup_sandbox ⇒ Object

Since:

  • 1.7.0



68
69
70
# File 'lib/poise_boiler/helpers/kitchen/policy_provisioner.rb', line 68

def cleanup_sandbox
  super if @sandbox_path
end

#create_sandbox ⇒ Object

Run our policy generation first.

Since:

  • 1.7.0



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/poise_boiler/helpers/kitchen/policy_provisioner.rb', line 47

def create_sandbox
  policy_base = File.join(config[:kitchen_root], '.kitchen', 'poise_policy')
  # Copy all my halite-y stuff to a folder. This should probably use a
  # temp dir instead.
  FileUtils.rm_rf(policy_base)
  convert_halite_cookbooks(policy_base) unless poise_helper_instance.options['no_gem']
  copy_test_cookbook(policy_base)
  copy_test_cookbooks(policy_base)
  # Generate a modified policy to use the cookbooks we just made.
  policy_path = generate_poise_policy(policy_base)
  # Compile that policy because the base provider doesn't do that.
  compile_poise_policy(policy_path)
  # Tell the base provider code to use our new policy instead.
  if $use_policyfile_zero
    config[:policyfile] = "#{config[:kitchen_root]}/#{policy_path}"
  else
    config[:policyfile_path] = policy_path
  end
  super
end