Class: ChefApply::Action::GenerateTempCookbook

Inherits:
Base
  • Object
show all
Defined in:
lib/chef_apply/action/generate_temp_cookbook.rb

Constant Summary

Constants inherited from Base

Base::PATH_MAPPING

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #target_host

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#escape_windows_path, #name, #notify, #run, #run_chef

Constructor Details

#initialize(options) ⇒ GenerateTempCookbook

Returns a new instance of GenerateTempCookbook.



38
39
40
41
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 38

def initialize(options)
  super(options)
  @generated_cookbook ||= ChefApply::TempCookbook.new
end

Instance Attribute Details

#generated_cookbookObject (readonly)

Returns the value of attribute generated_cookbook.



24
25
26
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 24

def generated_cookbook
  @generated_cookbook
end

Class Method Details

.from_options(opts) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 26

def self.from_options(opts)
  if opts.key?(:recipe_spec)
    GenerateCookbookFromRecipe.new(opts)
  elsif opts.key?(:resource_name) &&
      opts.key?(:resource_type) &&
      opts.key?(:resource_properties)
    GenerateCookbookFromResource.new(opts)
  else
    raise MissingOptions.new(opts)
  end
end

Instance Method Details

#generateObject

Raises:

  • (NotImplemented)


49
50
51
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 49

def generate
  raise NotImplemented
end

#perform_actionObject



43
44
45
46
47
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 43

def perform_action
  notify(:generating)
  generate
  notify(:success)
end