Exception: ChefApply::TargetHost::ConnectionFailure
- Inherits:
-
ErrorNoLogs
- Object
- StandardError
- Error
- ErrorNoLogs
- ChefApply::TargetHost::ConnectionFailure
- Defined in:
- lib/chef_apply/target_host.rb
Instance Attribute Summary
Attributes inherited from Error
#decorate, #id, #params, #show_log, #show_stack
Instance Method Summary collapse
-
#initialize(original_exception, connection_opts) ⇒ ConnectionFailure
constructor
TODO: Currently this only handles sudo-related errors; we should also look at e.cause for underlying connection errors which are presently only visible in log files.
Constructor Details
#initialize(original_exception, connection_opts) ⇒ ConnectionFailure
TODO: Currently this only handles sudo-related errors; we should also look at e.cause for underlying connection errors which are presently only visible in log files.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/chef_apply/target_host.rb', line 316 def initialize(original_exception, connection_opts) sudo_command = connection_opts[:sudo_command] init_params = # Comments below show the original_exception.reason values to check for instead of strings, # after train 1.4.12 is consumable. case original_exception. # original_exception.reason when /Sudo requires a password/ # :sudo_password_required "CHEFTRN003" when /Wrong sudo password/ # :bad_sudo_password "CHEFTRN004" when /Can't find sudo command/, /No such file/, /command not found/ # :sudo_command_not_found # NOTE: In the /No such file/ case, reason will be nil - we still have # to check message text. (Or PR to train to handle this case) ["CHEFTRN005", sudo_command] # :sudo_command_not_found when /Sudo requires a TTY.*/ # :sudo_no_tty "CHEFTRN006" when /has no keys added/ "CHEFTRN007" else ["CHEFTRN999", original_exception.] end super(*(Array(init_params).flatten)) end |