Project

General

Profile

Bug #12456

Handilng non-utf characters ssh exceptions

Added by Ivan Necas over 6 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

The exception comming from ssh or scp can include some non-utf characters,
that causes json serialization errors, such in this case:

1. configure the remote_working_dir on smart_proxy_remote_execution_ssh to point to a directory where the user doens't
have write permissions

2. run a command

3. an exception is raised no the proxy side

 [#<Proxy::RemoteExecution::Ssh::CommandUpdate::DebugData:0x000000047b6390 @data="Error initializing command #<Proxy::RemoteExecution::Ssh::Dispatcher::Command:0x00000004822590>\nRuntimeError Unable to create directory on remote system /var/tmp/no-perms/foreman-ssh-cmd-70dd8044-816a-47a9-b69c-2a68b3c75c1f: exit code: 1\n mkdir: cannot create directory \xE2\x80\x98/var/tmp/no-perms/foreman-ssh-cmd-70dd8044-816a-47a9-b69c-2a68b3c75c1f\xE2\x80\x99: Permission denied\n", @timestamp=2015-11-12 14:42:16 +0100>, #<Proxy::RemoteExecution::Ssh::CommandUpdate::StatusData:0x000000047b62f0 @data="EXCEPTION", @timestamp=2015-11-12 14:42:16 +0100>]
[2015-11-12 14:42:16.473 #10986] DEBUG -- dynflow: command [#<Proxy::RemoteExecution::Ssh::Dispatcher::Command:0x00000004822590>] finished with status EXCEPTION
[2015-11-12 14:42:16.474 #10986] DEBUG -- dynflow: closing session to inecas@172.17.0.88
[2015-11-12 14:42:16.475 #10986] DEBUG -- dynflow: closing session for command [#<Proxy::RemoteExecution::Ssh::Dispatcher::Command:0x00000004822590>], 0 session(s) left

4. this error doesn't propagate to the output due to another exception:

E, [2015-11-12T14:42:16.481503 #10986] ERROR -- : "\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
/home/inecas/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/multi_json-1.11.2/lib/multi_json/adapters/json_common.rb:19:in `encode'
/home/inecas/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/multi_json-1.11.2/lib/multi_json/adapters/json_common.rb:19:in `to_json'

Related issues

Related to Foreman Remote Execution - Bug #12437: unable to view host job detailClosed2015-11-10
Related to Smart Proxy - Bug #10581: UTF8 encoding error on realm update with freeipaClosed2015-05-21
Related to Foreman Remote Execution - Bug #18356: Smart proxy worker fails on encoding errorClosed2017-02-01

Associated revisions

Revision 42d6815c (diff)
Added by Ivan Necas over 6 years ago

Fixes #12456 - handle the encoding in general, not just in stdout/stderr

We can run into similar issues with exceptions as well. Handling the
encoding on more high level.

Revision 0e757786
Added by Ivan Necas over 6 years ago

Merge pull request #15 from iNecas/handle-encoding-in-exceptions

Fixes #12456 - handle the encoding in general, not just in stdout/stderr

History

#1 Updated by Ivan Necas over 6 years ago

  • Legacy Backlogs Release (now unused) set to 106

#2 Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ivan Necas
  • Pull request https://github.com/theforeman/smart_proxy_remote_execution_ssh/pull/15 added

#3 Updated by Ivan Necas over 6 years ago

  • Related to Bug #12437: unable to view host job detail added

#4 Updated by Ivan Necas over 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Ivan Necas almost 6 years ago

  • Related to Bug #10581: UTF8 encoding error on realm update with freeipa added

#6 Updated by Marek Hulán over 5 years ago

  • Related to Bug #18356: Smart proxy worker fails on encoding error added

Also available in: Atom PDF