Class: OctocatalogDiff::Util::Catalogs

Inherits:
Object
  • Object
show all
Defined in:
lib/octocatalog-diff/util/catalogs.rb

Overview

Helper class to construct catalogs, performing all necessary steps such as bootstrapping directories, installing facts, and running puppet.

Instance Method Summary collapse

Constructor Details

#initialize(options, logger) ⇒ Catalogs

Constructor

Parameters:

  • options (Hash)

    Options

  • logger (Logger)

    Logger object



18
19
20
21
22
23
# File 'lib/octocatalog-diff/util/catalogs.rb', line 18

def initialize(options, logger)
  @options = options
  @logger = logger
  @catalogs = nil
  raise '@logger must not be nil' if @logger.nil?
end

Instance Method Details

#bootstrap_then_exitObject

Handles the “bootstrap then exit” option, which bootstraps directories but exits without compiling catalogs.



34
35
36
37
38
39
# File 'lib/octocatalog-diff/util/catalogs.rb', line 34

def bootstrap_then_exit
  @logger.debug('Begin bootstrap_then_exit')
  OctocatalogDiff::CatalogUtil::Bootstrap.bootstrap_directory_parallelizer(@options, @logger)
  @logger.debug('Success bootstrap_then_exit')
  @logger.info('Successfully completed --bootstrap-then-exit action')
end

#catalogsHash

Compile catalogs. This handles building both the old and new catalog (in parallel) and returns only when both catalogs have been built.

Returns:

  • (Hash)

    { :from => [OctocatalogDiff::Catalog], :to => [OctocatalogDiff::Catalog] }



28
29
30
# File 'lib/octocatalog-diff/util/catalogs.rb', line 28

def catalogs
  @catalogs ||= build_catalog_parallelizer
end