Sha256: 8da683f7b575cdb759f5af10aedbd6bd3e1188f12dac892cd1210059306e3a7d

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

# Include recipe basics so require 'chef_metal' will load everything
require 'chef_metal/recipe_dsl'
require 'chef/resource/machine'
require 'chef/provider/machine'
require 'chef/resource/machine_file'
require 'chef/provider/machine_file'

require 'chef_metal/inline_resource'

module ChefMetal
  def self.with_provisioner(provisioner)
    old_provisioner = ChefMetal.enclosing_provisioner
    ChefMetal.enclosing_provisioner = provisioner
    if block_given?
      begin
        yield
      ensure
        ChefMetal.enclosing_provisioner = old_provisioner
      end
    end
  end

  def self.with_provisioner_options(provisioner_options)
    old_provisioner_options = ChefMetal.enclosing_provisioner_options
    ChefMetal.enclosing_provisioner_options = provisioner_options
    if block_given?
      begin
        yield
      ensure
        ChefMetal.enclosing_provisioner_options = old_provisioner_options
      end
    end
  end

  def self.inline_resource(provider, &block)
    InlineResource.new(provider).instance_eval(&block)
  end

  @@enclosing_provisioner = nil
  def self.enclosing_provisioner
    @@enclosing_provisioner
  end
  def self.enclosing_provisioner=(provisioner)
    @@enclosing_provisioner = provisioner
  end

  @@enclosing_provisioner_options = nil
  def self.enclosing_provisioner_options
    @@enclosing_provisioner_options
  end
  def self.enclosing_provisioner_options=(provisioner_options)
    @@enclosing_provisioner_options = provisioner_options
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chef-metal-0.4 lib/chef_metal.rb
chef-metal-0.3.1 lib/chef_metal.rb
chef-metal-0.3 lib/chef_metal.rb
chef-metal-0.2.1 lib/chef_metal.rb
chef-metal-0.2 lib/chef_metal.rb