Class: ConfigOMat::Cond::RetriesLeft

Inherits:
LifecycleVM::CondBase
  • Object
show all
Defined in:
lib/config_o_mat/configurator/cond/retries_left.rb

Instance Method Summary collapse

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/config_o_mat/configurator/cond/retries_left.rb', line 24

def call
  logger&.error(:retry_from_failure, state: error_op.state_name, op: error_op.op.name, errors: error_op.errors)

  # If we aren't currently applying a profile then there's nothing for us to retry.
  if applying_profile.nil?
    logger&.error(:cannot_retry, reason: 'not applying profile')
    return false
  end

  # If we're out of retries, well, no more retrying
  if retries_left.zero?
    logger&.error(:cannot_retry, reason: 'out of retries')
    return false
  end

  true
end