Module: CemAcpt

Extended by:
Logging
Defined in:
lib/cem_acpt.rb,
lib/cem_acpt/utils.rb,
lib/cem_acpt/runner.rb,
lib/cem_acpt/context.rb,
lib/cem_acpt/logging.rb,
lib/cem_acpt/version.rb,
lib/cem_acpt/test_data.rb,
lib/cem_acpt/puppet_helpers.rb,
lib/cem_acpt/shared_objects.rb,
lib/cem_acpt/image_name_builder.rb,
lib/cem_acpt/spec_helper_acceptance.rb

Defined Under Namespace

Modules: Bootstrap, ConfigUtils, Context, CoreExtensions, Logging, Platform, PuppetHelpers, SpecHelperAcceptance, TestData, Utils Classes: Config, ConfigImmutableError, ImageNameBuilder, LocalPortAllocationError, LocalPortAllocator, NodeClaimedError, NodeData, NodeDoesNotExistError, NodeInventory, RunHandler, Runner

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Methods included from Logging

current_log_config, current_log_config, current_log_format, current_log_level, current_log_level, included, logger, new_log_config, new_log_config, new_log_formatter, new_log_level, new_log_level

Class Method Details

.configure_spec_helper!Object

This methods is used in spec_helper_acceptance.rb to set up baseline configurations used in acceptance tests.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cem_acpt/spec_helper_acceptance.rb', line 8

def self.configure_spec_helper!
  require 'serverspec'
  require 'yaml'

  RSpec.configure do |config|
    config.include CemAcpt::SpecHelperAcceptance
    config.extend CemAcpt::SpecHelperAcceptance
    config.add_setting :acpt_test_data, default: {}
    config.add_setting :acpt_node_inventory
  end

  return unless RSpec.configuration.acpt_node_inventory.nil?

  raise 'Node inventory file not found!' unless File.exist?('spec/fixtures/node_inventory.yaml')

  node_inventory = NodeInventory.new
  node_inventory.save_on_claim
  node_inventory.save_file_path = 'spec/fixtures/node_inventory.yaml'
  node_inventory.load
  RSpec.configuration.acpt_node_inventory = node_inventory
end

.run(params) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cem_acpt.rb', line 12

def self.run(params)
  require_relative 'cem_acpt/runner'

  logger.level = params[:log_level] if params[:log_level]

  if params[:log_file]
    log_fmt = params[:log_format] ? new_log_formatter(params[:log_format]) : new_log_formatter(:file)
    logger.formatter = log_fmt
    logger.reopen(params[:log_file])
  elsif params[:log_format]
    logger.formatter = new_log_formatter(params[:log_format])
  end

  CemAcpt::RunHandler.new(params).run
end