Module: Chef::DSL::Recipe

Defined in:
lib/chef_metal/recipe_dsl.rb

Instance Method Summary collapse

Instance Method Details

#add_provisioner_options(options, &block) ⇒ Object



33
34
35
# File 'lib/chef_metal/recipe_dsl.rb', line 33

def add_provisioner_options(options, &block)
  run_context.chef_metal.add_provisioner_options(options, &block)
end

#current_provisioner_optionsObject



29
30
31
# File 'lib/chef_metal/recipe_dsl.rb', line 29

def current_provisioner_options
  run_context.chef_metal.current_provisioner_options
end

#machine(name, &block) ⇒ Object

When the machine resource is first declared, create a machine_batch (if there isn’t one already)



39
40
41
42
43
44
# File 'lib/chef_metal/recipe_dsl.rb', line 39

def machine(name, &block)
  if !run_context.chef_metal.current_machine_batch
    run_context.chef_metal.with_machine_batch declare_resource(:machine_batch, 'default', caller[0])
  end
  declare_resource(:machine, name, caller[0], &block)
end

#with_machine_batch(the_machine_batch, options = {}, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/chef_metal/recipe_dsl.rb', line 15

def with_machine_batch(the_machine_batch, options = {}, &block)
  if the_machine_batch.is_a?(String)
    the_machine_batch = machine_batch the_machine_batch do
      if options[:action]
        action options[:action]
      end
      if options[:max_simultaneous]
        max_simultaneous options[:max_simultaneous]
      end
    end
  end
  run_context.chef_metal.with_machine_batch(the_machine_batch, &block)
end

#with_provisioner(provisioner, &block) ⇒ Object



7
8
9
# File 'lib/chef_metal/recipe_dsl.rb', line 7

def with_provisioner(provisioner, &block)
  run_context.chef_metal.with_provisioner(provisioner, &block)
end

#with_provisioner_options(provisioner_options, &block) ⇒ Object



11
12
13
# File 'lib/chef_metal/recipe_dsl.rb', line 11

def with_provisioner_options(provisioner_options, &block)
  run_context.chef_metal.with_provisioner_options(provisioner_options, &block)
end