Class: Kitchen::Provisioner::RunListExpansionFromKitchen

Inherits:
Chef::RunList::RunListExpansion
  • Object
show all
Defined in:
lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb

Overview

fetches roles from kitchen roles directory

Instance Method Summary collapse

Constructor Details

#initialize(environment, run_list_items, source = nil, role_dir = nil) ⇒ RunListExpansionFromKitchen

Returns a new instance of RunListExpansionFromKitchen.


25
26
27
28
# File 'lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb', line 25

def initialize(environment, run_list_items, source = nil, role_dir = nil)
  @role_dir = role_dir
  super(environment, run_list_items, source)
end

Instance Method Details

#fetch_role(name, included_by) ⇒ Object


30
31
32
33
34
35
# File 'lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb', line 30

def fetch_role(name, included_by)
  role_file = File.join(@role_dir, "#{name}.json")
  ::Chef::Role.json_create(JSON.parse(File.read(role_file)))
rescue ::Chef::Exceptions::RoleNotFound
  role_not_found(name, included_by)
end