Project

General

Profile

Actions

Bug #31163

closed

Registration facet does not reload properly when code changes

Added by Tomer Brisker almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Category:
Rails
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When testing something on the host api, every time the code reloaded the api breaks due to the registration facet not being properly registered.
To reproduce, hit `/api/hosts`, change something in the code so rails will reload, and hit the `/api/hosts` endpoint again.
Interesting portion of the stacktrace:

2020-10-25T18:23:41 [I|app|8e68af37] Backtrace for 'Action failed' error (ActionView::Template::Error): undefined local variable or method `registration_facet' for #<Host::Managed:0x00007f6f74257908>
 8e68af37 | Did you mean?  registration_facet!
 8e68af37 |                registration_token
 8e68af37 |                registration_url
 8e68af37 | /home/tbrisker/.rvm/gems/ruby-2.6.3@foreman/gems/activemodel-6.0.3.4/lib/active_model/attribute_methods.rb:432:in `method_missing'
 8e68af37 | /home/tbrisker/.rvm/gems/ruby-2.6.3@foreman/gems/audited-4.9.0/lib/audited/auditor.rb:99:in `method_missing'
 8e68af37 | /home/tbrisker/foreman/app/models/concerns/foreman_register/host_extensions.rb:8:in `registration_facet!'
 8e68af37 | /home/tbrisker/foreman/app/models/concerns/foreman_register/host_extensions.rb:12:in `registration_token'
 8e68af37 | /home/tbrisker/foreman/app/views/api/v2/hosts/main.json.rabl:37:in `block in cached_source_2123035666155962752'

Related issues 2 (0 open2 closed)

Related to Foreman - Bug #31518: foreman_hooks: create hook fails to render host with "You cannot call create unless the parent is saved"ClosedOndřej EzrActions
Has duplicate Foreman - Bug #31309: Creating new host fails with undefined local variable or method `registration_facet'DuplicateActions
Actions

Also available in: Atom PDF