Project

General

Profile

Actions

Bug #37234

open

Template import fails in Foreman 3.9.1

Added by Nathan Zachary 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Hello,

I exported (to the local filesystem) my Foreman templates from an instance running 3.6.1 and tried to import them (from the local filesystem) into a newer instance running 3.9.1, but the import fails with the following Ruby error when using the web UI template import:

2024-03-07T18:29:01 [I|app|3dadd427] Started POST "/ui_template_syncs/import" for $IP_REMOVED at 2024-03-07 18:29:01 +0000
2024-03-07T18:29:01 [I|app|3dadd427] Processing by UiTemplateSyncsController#import as JSON
2024-03-07T18:29:01 [I|app|3dadd427]   Parameters: {"repo"=>"/var/lib/foreman/templates", "branch"=>"", "dirname"=>"", "filter"=>"", "negate"=>false, "prefix"=>"", "associate"=>"new", "force"=>false, "lock"=>"unlock", "organization_ids"=>[1], "location_ids"=>[2], "ui_template_sync"=>{"repo"=>"/var/lib/foreman/templates", "branch"=>"", "dirname"=>"", "filter"=>"", "negate"=>false, "prefix"=>"", "associate"=>"new", "force"=>false, "lock"=>"unlock", "organization_ids"=>[1], "location_ids"=>[2]}}
2024-03-07T18:29:01 [W|app|3dadd427] undefined method `with_indifferent_access' for #<String:0x000055be2fd13b50>
2024-03-07T18:29:01 [I|app|3dadd427] Backtrace for 'undefined method `with_indifferent_access' for #<String:0x000055be2fd13b50>' error (NoMethodError): undefined method `with_indifferent_access' for #<String:0x000055be2fd13b50>
 3dadd427 | /usr/share/foreman/app/models/template.rb:115:in `parse_metadata'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/services/foreman_templates/template_importer.rb:54:in `block in parse_files!'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/services/foreman_templates/template_importer.rb:49:in `each'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/services/foreman_templates/template_importer.rb:49:in `parse_files!'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/services/foreman_templates/template_importer.rb:27:in `import_from_files'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/services/foreman_templates/template_importer.rb:20:in `import!'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_templates-9.4.0/app/controllers/ui_template_syncs_controller.rb:17:in `import'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:228:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-5.4.2/lib/audited/sweeper.rb:16:in `around'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-5.4.2/lib/audited/sweeper.rb:16:in `around'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:137:in `run_callbacks'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:41:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/rescue.rb:22:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.7.6/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:165:in `process'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:39:in `process'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:190:in `dispatch'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:254:in `dispatch'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `each'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `serve'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:842:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-dsl-2.6.1/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-1.3.0/lib/apipie/static_dispatcher.rb:74:in `call'
 3dadd427 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 3dadd427 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-1.3.0/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/tempfile_reaper.rb:15:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/etag.rb:27:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/conditional_get.rb:40:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/head.rb:12:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 3dadd427 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:266:in `context'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:260:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:98:in `run_callbacks'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:37:in `call_app'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:28:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 3dadd427 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/method_override.rb:24:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/runtime.rb:22:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/executor.rb:14:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/sendfile.rb:110:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.7.6/lib/rails/engine.rb:539:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/urlmap.rb:74:in `block in call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `each'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/configuration.rb:272:in `call'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/request.rb:100:in `block in handle_request'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/request.rb:99:in `handle_request'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/server.rb:464:in `process_client'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/server.rb:245:in `block in run'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-6.4.1/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
 3dadd427 | /usr/share/foreman/vendor/ruby/2.7.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-03-07T18:29:01 [I|app|3dadd427]   Rendered common/500.html.erb (Duration: 2.3ms | Allocations: 986)
2024-03-07T18:29:01 [I|app|3dadd427] Completed 500 Internal Server Error in 19ms (Views: 3.3ms | ActiveRecord: 1.7ms | Allocations: 6164)
2024-03-07T18:29:02 [I|app|284d7dab] Started GET "/notification_recipients" for $IP_REMOVED at 2024-03-07 18:29:02 +0000
2024-03-07T18:29:02 [I|app|284d7dab] Processing by NotificationRecipientsController#index as JSON
2024-03-07T18:29:02 [I|app|284d7dab] Completed 200 OK in 8ms (Views: 0.1ms | ActiveRecord: 1.2ms | Allocations: 1977)

Thereafter, I tried using Hammer, but it fails with very little information:

# hammer import-templates --repo /var/lib/foreman/templates --verbose true
NOTE: Gem.gunzip is deprecated; use Gem::Util.gunzip instead. It will be removed on or after 2018-12-01.
Gem.gunzip called from /usr/lib/ruby/vendor_ruby/unicode/display_width/index.rb:5.
Could not import

I wouldn't think that the error is caused by the differing Foreman versions (3.6.1 source and 3.9.1 target), given the Ruby error message.

Thank you for your support.

Cheers,
Nathan Zachary


Related issues 1 (0 open1 closed)

Related to foreman-tasks - Bug #24648: undefined method `with_indifferent_access' for #<String:0x00000008ecc658> (NoMethodError)ClosedIvan NecasActions
Actions #1

Updated by Nathan Zachary 2 months ago

  • Related to Bug #24648: undefined method `with_indifferent_access' for #<String:0x00000008ecc658> (NoMethodError) added
Actions

Also available in: Atom PDF