Description of problem: When building hosts, the templates get rendered using a token that is valid for a certain amount of time. This token is also verified in the "built" template, which is suposed to flip the host from "in build" to "build finished". Thus if you start your deployment while the token was still OK, and it expires *during* the build, the state will not be switched and the machine will boot in build mode again on next reboot. The new build will error out, but the machine will remain in the booted broken build system and will not boot from local disc. The problem is because of: The unattended "built" template calls "find_host_by_token" which calls "Host.for_token(token).first" (see app/controllers/unattended_controller.rb) for_token is defined as scope :for_token, ->(token) { joins(:token).where(:tokens => { :value => token }).where("expires >= ?", Time.now.utc.to_s(:db)).select('hosts.*') } (in app/models/concerns/hostext/token.rb upstream, app/models/host/managed.rb in satellite 6.2) thus the host is never found and the "built" mode flip is never executed. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. put host in build mode 2. wait till token is almost expired 3. boot and build machine Actual results: host is not marked as "finished"/"built" when token expires before /unattended/built is called Expected results: host is marked as built Additional info: Not sure if it would be better to have the built template not verify the token expiry, or extend the token for some time when the actual build starts. Or maybe just have a clenaup task that flips all machines that have expired tokens into "built" state.
Created upstream issue: http://projects.theforeman.org/issues/19173
Connecting redmine issue http://projects.theforeman.org/issues/19173 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19173 has been resolved.
Verified on Sat 6.4 snap 23 using libvirt host and various lengths of "Token duration" setting. With right duration, the host starts to build, meanwhile build is marked as 'token expired', then when build finishes, it is again marked as Installed. After that, machine reboots as expected.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:2927