Method: Puppet::ModuleTool.set_option_defaults

Defined in:
lib/puppet/module_tool.rb

.set_option_defaults(options) ⇒ Object

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.

TODO:

Validate the above note…

Note:

Unfortunately the whole point of this method is the side effect of

modifying the options parameter. This same hash is referenced both when_invoked and when_rendering. For this reason, we are not returning a duplicate. An :environment_instance and a :target_dir are added/updated in the options parameter.

Parameters:

  • options (Hash<Symbol,String>)

    This hash will contain any command-line arguments that are not Settings, as those will have already been extracted by the underlying application code.



125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/puppet/module_tool.rb', line 125

def self.set_option_defaults(options)
  current_environment = environment_from_options(options)

  modulepath = [options[:target_dir]] + current_environment.full_modulepath

  face_environment = current_environment.override_with(:modulepath => modulepath.compact)

  options[:environment_instance] = face_environment

  # Note: environment will have expanded the path
  options[:target_dir] = face_environment.full_modulepath.first
end