Class: Chef::RunList::RunListExpansionFromAPI

Inherits:
RunListExpansion show all
Defined in:
lib/chef/run_list/run_list_expansion.rb

Overview

Expand a run list from the chef-server API.

Instance Attribute Summary

Attributes inherited from RunListExpansion

#all_missing_roles, #better_run_list_trace, #default_attrs, #environment, #missing_roles_with_including_role, #override_attrs, #recipes, #role_errors, #run_list_items, #run_list_trace, #source

Instance Method Summary collapse

Methods inherited from RunListExpansion

#applied_role?, #apply_role_attributes, #errors, #errors?, #expand, #inflate_role, #initialize, #role_not_found, #roles, #to_h, #to_json

Constructor Details

This class inherits a constructor from Chef::RunList::RunListExpansion

Instance Method Details

#fetch_role(name, included_by) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/chef/run_list/run_list_expansion.rb', line 221

def fetch_role(name, included_by)
  Chef::Role.from_hash(rest.get("roles/#{name}"))
rescue Net::HTTPClientException => e
  if e.message == '404 "Not Found"'
    role_not_found(name, included_by)
  else
    raise
  end
rescue Exception => e
  @role_errors[name] = e.to_s
  raise
end

#restObject



217
218
219
# File 'lib/chef/run_list/run_list_expansion.rb', line 217

def rest
  @rest ||= (source || Chef::ServerAPI.new(Chef::Config[:chef_server_url]))
end