Class: Kitchen::Provisioner::ChefZeroShopify

Inherits:
ChefZero
  • Object
show all
Defined in:
lib/kitchen/provisioner/chef_zero_shopify.rb

Overview

We’ll sneak some code in before the default chef zero provisioner runs This will allow us to convert our roles to JSON, and flatten at once

Instance Method Summary collapse

Instance Method Details

#create_sandboxObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kitchen/provisioner/chef_zero_shopify.rb', line 13

def create_sandbox
  tmpdir = Dir.mktmpdir('chef-shopify-inject')

  at_exit do
    FileUtils.rm_rf(tmpdir)
  end

  flatten_roles(config, tmpdir) if config[:roles_path]
  write_data_bag_key(config, tmpdir) if config[:data_bag_secret] && config[:encrypted_data_bag_secret_key_path]
  decrypt_data_bags(config, tmpdir) if config[:data_bags_path]
  super
rescue => e
  puts e.message
  puts e.backtrace
  raise 'Failed extend the shopify provisioner!'
end