Class: ChefApply::Action::GenerateTempCookbook

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

Defined Under Namespace

Classes: RecipeLookup, TempCookbook

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #target_host

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#name, #notify, #run

Constructor Details

#initialize(options) ⇒ GenerateTempCookbook

Returns a new instance of GenerateTempCookbook.



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

def initialize(options)
  super(options)
  require_relative "generate_temp_cookbook/temp_cookbook"
  @generated_cookbook ||= TempCookbook.new
end

Instance Attribute Details

#generated_cookbookObject (readonly)

Returns the value of attribute generated_cookbook.



22
23
24
# File 'lib/chef_apply/action/generate_temp_cookbook.rb', line 22

def generated_cookbook
  @generated_cookbook
end

Class Method Details

.from_options(opts) ⇒ Object



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

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)


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

def generate
  raise NotImplemented
end

#perform_actionObject



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

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