Project

General

Profile

Bug #12325

Avatars are broken after restoring Foreman DB on a new host

Added by Frank Hart almost 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Authentication
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

After restoring the Foreman DB on a new host, the avatars are broken. The file with the hash is created on disk in /usr/share/foreman/public/assets/avatars, but it is empty.

stbenjam on IRC recommended to run this on the Foreman host:

echo "User.all.each { |user| user.update_attributes(:avatar_hash => nil) }" | foreman-rake console 

After logging in again, I get this in the logfile:

2015-10-27 14:23:44 [sql] [I] Successfully decrypted field for AuthSourceLdap Active Directory
2015-10-27 14:23:45 [app] [W] Action failed
 | Encoding::UndefinedConversionError: "\xFF" from ASCII-8BIT to UTF-8
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:176:in `write'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:176:in `block in store_avatar'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:176:in `open'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:176:in `store_avatar'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:162:in `block in attributes_values'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:159:in `each'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:159:in `map'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:159:in `attributes_values'
 | /usr/share/foreman/app/models/auth_sources/auth_source_ldap.rb:53:in `authenticate'
 | /usr/share/foreman/app/models/user.rb:187:in `try_to_login'
 | /usr/share/foreman/app/controllers/users_controller.rb:71:in `login'

Related issues

Related to Foreman - Bug #12730: remove fakefs gemClosed2015-12-07

Associated revisions

Revision b5782137 (diff)
Added by Shlomi Zadok almost 4 years ago

Fixes #12325 - Add to_utf8 method and ensure avatar_path returns in utf-8

Revision 5cf97f88 (diff)
Added by Shlomi Zadok over 3 years ago

Fixes #12325 - Add to_utf8 method and ensure avatar_path returns in utf-8

(cherry picked from commit b57821379e4af56e81780051ab7737318b1db116)

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Category set to Authentication

#2 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Shlomi Zadok
  • Pull request https://github.com/theforeman/foreman/pull/2888 added

#3 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 104

#4 Updated by Shlomi Zadok almost 4 years ago

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

#5 Updated by Dominic Cleal over 3 years ago

Also available in: Atom PDF