Class: R10K::Deployment::Config::Loader Private

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/r10k/deployment/config/loader.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

CONFIG_FILE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'r10k.yaml'
DEFAULT_LOCATION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

File.join('/etc/puppetlabs/r10k', CONFIG_FILE)
OLD_DEFAULT_LOCATION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

File.join('/etc', CONFIG_FILE)

Constants included from Logging

Logging::LOG_LEVELS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level

Constructor Details

#initializeLoader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Search for a deployment configuration file (r10k.yaml) in several locations



17
18
19
20
# File 'lib/r10k/deployment/config/loader.rb', line 17

def initialize
  @loadpath = []
  populate_loadpath
end

Instance Attribute Details

#loadpathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'lib/r10k/deployment/config/loader.rb', line 10

def loadpath
  @loadpath
end

Instance Method Details

#searchString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The path to the first valid configfile.

Returns:

  • (String)

    The path to the first valid configfile



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/r10k/deployment/config/loader.rb', line 23

def search

  # If both default files are present, issue a warning.
  if (File.file? DEFAULT_LOCATION) && (File.file? OLD_DEFAULT_LOCATION)
    logger.warn "Both #{DEFAULT_LOCATION} and #{OLD_DEFAULT_LOCATION} configuration files exist."
    logger.warn "#{DEFAULT_LOCATION} will be used."
  end

  path = @loadpath.find {|filename| File.file? filename}

  if path == OLD_DEFAULT_LOCATION
    logger.warn "The r10k configuration file at #{OLD_DEFAULT_LOCATION} is deprecated."
    logger.warn "Please move your r10k configuration to #{DEFAULT_LOCATION}."
  end

  path
end