foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Fixes #35203 - bulk rebuild host if token expired

Open sbernhard opened this issue 3 years ago • 3 comments

If a host is in build mode and the token is expired, it should be possible to rebuild this host via bulk rebuild host action.

sbernhard avatar Jul 20 '22 22:07 sbernhard

Issues: #35203

theforeman-bot avatar Jul 20 '22 22:07 theforeman-bot

Hi @sbernhard, thanks for the PR, can you please share the steps how to reproduce the issue, because on my local devel setup (latest develop) it looks like it works, see my steps:

  • Build the host
  • Expire token
bundle exec rails console
host = Host.find(ID)
host.token.update(expires: Time.now.utc)
h.token_expired?
=> true
  • Go back to All hosts, select Build hosts action and confirm

I got green message "The selected hosts will execute a build operation on next reboot"

stejskalleos avatar Aug 02 '22 12:08 stejskalleos

  • I configured the setting "installation token lifetime" to 2 minutes.
  • Host is powered on
  • I press "build host" but don't reboot the host. Therefore, after 2 minutes the token has expired
  • After I see, the "token" has expired on the host, I go to the host overview page
  • On the host overview page I press "Build Host" and select this host and I set "reboot now"

Unfortunately, the host can not be build successfully. Maybe you get the green message, but in the log file you see, that templates are not built, etc.

sbernhard avatar Aug 02 '22 12:08 sbernhard

After I see, the "token" has expired on the host, I go to the host overview page On the host overview page I press "Build Host" and select this host and I set "reboot now"

I followed your steps, and I don't have "Build Host" button on the host detail, only "cancel build" button

build

stejskalleos avatar Aug 11 '22 07:08 stejskalleos

On the host overview page, you select the host for which you want to start a action. Then you select the action "Build host" - which would then start to build this host.

Actually, if you go to the host itself (Host details page) the host would be in build state and the only available action would be "cancel build". On the host overview page, you don't have the option to cancel the build. The user expectation is, that if you are on the host overview page and you have selected a list of hosts and press "build host" that the build host action is started - even if some certain host are already in "build state" - it should just start to build the host.

sbernhard avatar Aug 11 '22 19:08 sbernhard

cped to 3.4-stable 64e6bfc23015eb695e1a03d71c42abd626a9cdc2

upadhyeammit avatar Sep 08 '22 10:09 upadhyeammit