Method: Bolt::Config#validate

Defined in:
lib/bolt/config.rb

#validateObject



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/bolt/config.rb', line 333

def validate
  if @data['modulepath']&.include?(@project.managed_moduledir.to_s)
    raise Bolt::ValidationError,
          "Found invalid path in modulepath: #{@project.managed_moduledir}. This path "\
          "is automatically appended to the modulepath and cannot be configured."
  end

  compile_limit = 2 * Etc.nprocessors
  unless compile_concurrency < compile_limit
    raise Bolt::ValidationError, "Compilation is CPU-intensive, set concurrency less than #{compile_limit}"
  end

  %w[hiera-config trusted-external-command inventoryfile].each do |opt|
    Bolt::Util.validate_file(opt, @data[opt]) if @data[opt]
  end

  if File.exist?(default_inventoryfile)
    Bolt::Util.validate_file('inventory file', default_inventoryfile)
  end
end