Module: Puppet::ApplicationSupport
- Defined in:
- lib/puppet/application_support.rb
Class Method Summary collapse
-
.configure_indirector_routes(application_name) ⇒ void
private
Reads the routes YAML settings from the file specified by Puppet and resets indirector termini for the current application class if listed.
-
.push_application_context(run_mode) ⇒ void
private
Pushes a Puppet Context configured with a remote environment for an agent (one that exists at the master end), and a regular environment for other modes.
Class Method Details
.configure_indirector_routes(application_name) ⇒ void
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.
This method returns an undefined value.
Reads the routes YAML settings from the file specified by Puppet and resets indirector termini for the current application class if listed.
For instance, PE uses this to set the master facts terminus to ‘puppetdb’ and its cache terminus to ‘yaml’.
47 48 49 50 51 52 53 54 |
# File 'lib/puppet/application_support.rb', line 47 def self.configure_indirector_routes(application_name) route_file = Puppet[:route_file] if Puppet::FileSystem.exist?(route_file) routes = YAML.load_file(route_file) application_routes = routes[application_name] Puppet::Indirector.configure_routes(application_routes) if application_routes end end |
.push_application_context(run_mode) ⇒ void
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.
This method returns an undefined value.
Pushes a Puppet Context configured with a remote environment for an agent (one that exists at the master end), and a regular environment for other modes. The configuration is overridden with options from the command line before being set in a pushed Puppet Context.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet/application_support.rb', line 19 def self.push_application_context(run_mode) Puppet.push_context(Puppet.base_context(Puppet.settings), "Update for application settings (#{run_mode})") # This use of configured environment is correct, this is used to establish # the defaults for an application that does not override, or where an override # has not been made from the command line. # configured_environment_name = Puppet[:environment] if run_mode.name == :agent configured_environment = Puppet::Node::Environment.remote(configured_environment_name) else configured_environment = Puppet.lookup(:environments).get!(configured_environment_name) end configured_environment = configured_environment.override_from_commandline(Puppet.settings) # Setup a new context using the app's configuration Puppet.push_context({:current_environment => configured_environment}, "Update current environment from application's configuration") end |