def process( answers_hash={}, items_yaml = nil )
@answers_hash = answers_hash
rb_files = File.expand_path( '../config/item/*.rb', File.dirname(__FILE__))
Dir.glob( rb_files ).sort_by(&:to_s).each { |file| require file }
if items_yaml.nil?
scenario = @answers_hash.fetch('cli::simp::scenario')
items_yaml = Simp::Cli::Config::ItemsYamlGenerator.new(scenario).generate_yaml
end
begin
items = YAML.load items_yaml
rescue Psych::SyntaxError => e
$stderr.puts "Invalid Items list YAML: #{e.message}"
$stderr.puts '>'*80
$stderr.puts items_yaml
$stderr.puts '<'*80
raise 'Internal error: invalid Items list YAML'
end
items << "HieradataYAMLFileWriter FILE=#{ @options.fetch( :puppet_system_file, '/dev/null') }"
items << "AnswersYAMLFileWriter FILE=#{ @options.fetch( :answers_output_file, '/dev/null') } USERAPPLY DRYRUNAPPLY"
item_queue = build_item_queue( [], items )
item_queue
end