Method: R10K::Action::Deploy::Module#initialize

Defined in:
lib/r10k/action/deploy/module.rb

#initialize(opts, argv, settings = {}) ⇒ Module

Note:

All arguments will be required in the next major version

Returns a new instance of Module.

Parameters:

  • opts (Hash)

    A hash of options defined in #allowed_initialized_opts and managed by the SetOps mixin within the Action::Base class. Corresponds to the CLI flags and options.

  • argv (Enumerable)

    Typically CRI::ArgumentList or Array. A list-like collection of the remaining arguments to the CLI invocation (after removing flags and options).

  • settings (Hash) (defaults to: {})

    A hash of configuration loaded from the relevant config (r10k.yaml).



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/r10k/action/deploy/module.rb', line 29

def initialize(opts, argv, settings = {})
  super

  requested_env = @opts[:environment] ? [@opts[:environment].gsub(/\W/, '_')] : []
  @modified_envs = []

  @settings = @settings.merge({
    overrides: {
      environments: {
        requested_environments: requested_env,
        generate_types: @generate_types
      },
      modules: {
        exclude_spec: settings.dig(:deploy, :exclude_spec),
        pool_size: @settings[:pool_size] || 4,
        requested_modules: @argv.map.to_a,
        # force here is used to make it easier to reason about
        force: !@no_force
      },
      forge: {
        allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false
      },
      purging: {},
      output: {}
    }
  })
end