Class: PuppetCatalogTest::BasePuppetAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb

Direct Known Subclasses

Puppet3xAdapter, Puppet4xAdapter

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ BasePuppetAdapter

Returns a new instance of BasePuppetAdapter.



5
6
7
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 5

def initialize(config)
  @config = config
end

Instance Method Details

#cleanupObject



52
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 52

def cleanup; end

#compile(node) ⇒ Object



48
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 48

def compile(node); end

#create_node(hostname, facts) ⇒ Object



49
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 49

def create_node(hostname, facts); end

#init_configObject

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 9

def init_config()
  config = @config
  manifest_path = config[:manifest_path]
  module_paths = config[:module_paths]
  config_dir = config[:config_dir]
  hiera_config = config[:hiera_config]
  verbose = config[:verbose]

  raise ArgumentError, "[ERROR] manifest_path must be specified" if !manifest_path
  raise ArgumentError, "[ERROR] manifest_path (#{manifest_path}) does not exist" if !FileTest.exist?(manifest_path)

  raise ArgumentError, "[ERROR] module_path must be specified" if !module_paths
  module_paths.each do |mp|
    raise ArgumentError, "[ERROR] module_path (#{mp}) does not exist" if !FileTest.directory?(mp)
  end

  if config_dir
    Puppet.settings.handlearg("--confdir", config_dir)
  end

  if verbose
    Puppet::Util::Log.newdestination(:console)
    Puppet::Util::Log.level = :debug
  end

  Puppet.settings.handlearg("--config", ".")
  Puppet.settings.handlearg("--manifest", manifest_path)

  module_path = module_paths.join(":")

  Puppet.settings.handlearg("--modulepath", module_path)

  if hiera_config
    raise ArgumentError, "[ERROR] hiera_config  (#{hiera_config}) does not exist" if !FileTest.exist?(hiera_config)
    Puppet.settings[:hiera_config] = hiera_config
  end
end

#parserObject



47
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 47

def parser; end

#prepareObject



51
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 51

def prepare; end

#versionObject



50
# File 'lib/puppet-catalog-test/puppet_adapter/base_puppet_adapter.rb', line 50

def version; end