Method: Puppet::Settings::EnvironmentConf.load_from
- Defined in:
- lib/puppet/settings/environment_conf.rb
.load_from(path_to_env, global_module_path) ⇒ EnvironmentConf
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.
Note:
logs warnings if the environment.conf contains any ini sections,
Given a path to a directory environment, attempts to load and parse an environment.conf in ini format, and return an EnvironmentConf instance.
An environment.conf is optional, so if the file itself is missing, or empty, an EnvironmentConf with default values will be returned.
or has settings other than the three handled for directory environments (:manifest, :modulepath, :config_version)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet/settings/environment_conf.rb', line 22 def self.load_from(path_to_env, global_module_path) path_to_env = File.(path_to_env) conf_file = File.join(path_to_env, 'environment.conf') config = nil begin config = Puppet.settings.parse_file(conf_file) validate(conf_file, config) section = config.sections[:main] rescue Errno::ENOENT # environment.conf is an optional file end new(path_to_env, section, global_module_path) end |