Class: Chef::PartialRun

Inherits:
Client
  • Object
show all
Defined in:
lib/garcon/chef/provider/partial.rb

Instance Method Summary collapse

Constructor Details

#initialize(partial, attributes = nil, arguments = {}) ⇒ PartialRun

Returns a new instance of PartialRun.



91
92
93
94
# File 'lib/garcon/chef/provider/partial.rb', line 91

def initialize(partial, attributes = nil, arguments = {})
  super(attributes, arguments)
  @partial = partial
end

Instance Method Details

#clean_attrsObject

Clean the node data



118
119
120
121
122
# File 'lib/garcon/chef/provider/partial.rb', line 118

def clean_attrs
  data = node.to_hash
  %w(run_list recipes roles).each { |k| data.delete(k) }
  data
end

#partial_run(run_list) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/garcon/chef/provider/partial.rb', line 96

def partial_run(run_list)
  cache_path = file_cache_path
  begin
    digest = Digest::MD5.hexdigest(@partial)
    Chef::Config[:file_cache_path] = file_cache_path("partial-#{digest}")
    run_ohai
    register unless Chef::Config[:solo]
    load_node
    run_list_items = run_list.split(',').collect do |item|
      Chef::RunList::RunListItem.new(item)
    end
    node.run_list(*run_list_items)
    build_node
    run_context = setup_run_context
    converge(run_context)
  ensure
    Chef::Config[:file_cache_path] = cache_path
  end
end

#run_completed_successfullyObject



124
125
126
# File 'lib/garcon/chef/provider/partial.rb', line 124

def run_completed_successfully
  # do nothing
end