Class: R10K::Action::Deploy::Environment
- Includes:
- DeployHelpers, Visitor
- Defined in:
- lib/r10k/action/deploy/environment.rb
Constant Summary
Constants included from Logging
Logging::LOG_LEVELS, Logging::SYSLOG_LEVELS_MAP
Instance Attribute Summary collapse
-
#force ⇒ Object
readonly
Deprecated.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(opts, argv, settings = {}) ⇒ Environment
constructor
A new instance of Environment.
Methods included from Visitor
Methods included from Logging
add_outputters, debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Methods included from DeployHelpers
#check_write_lock!, #expect_config!
Constructor Details
#initialize(opts, argv, settings = {}) ⇒ Environment
Note:
All arguments will be required in the next major version
Returns a new instance of Environment.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/r10k/action/deploy/environment.rb', line 32 def initialize(opts, argv, settings = {}) super # instance variables below are set by the super class based on the # spec of #allowed_initialize_opts and any command line flags. This # gives a preference order of cli flags > config files > defaults. @settings = @settings.merge({ overrides: { environments: { requested_environments: @argv.map { |arg| arg.gsub(/\W/,'_') }, default_branch_override: @default_branch_override, generate_types: @generate_types || settings.dig(:deploy, :generate_types) || false, preload_environments: true, incremental: @incremental }, modules: { default_ref: settings.dig(:git, :default_ref), exclude_spec: settings.dig(:deploy, :exclude_spec), requested_modules: [], deploy_modules: @modules, pool_size: @settings[:pool_size] || 4, force: !@no_force, # force here is used to make it easier to reason about }, purging: { purge_levels: settings.dig(:deploy, :purge_levels) || [], purge_allowlist: settings.dig(:deploy, :purge_allowlist) || [] }, forge: { allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false }, output: {} } }) end |
Instance Attribute Details
#force ⇒ Object (readonly)
Deprecated
18 19 20 |
# File 'lib/r10k/action/deploy/environment.rb', line 18 def force @force end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
20 21 22 |
# File 'lib/r10k/action/deploy/environment.rb', line 20 def settings @settings end |
Instance Method Details
#call ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/r10k/action/deploy/environment.rb', line 67 def call @visit_ok = true begin expect_config! deployment = R10K::Deployment.new(@settings) check_write_lock!(@settings) deployment.accept(self) rescue => e @visit_ok = false logger.error R10K::Errors::Formatting.format_exception(e, @trace) end @visit_ok end |