Fixes #35203 - bulk rebuild host if token expired
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.
Issues: #35203
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 hostsaction and confirm
I got green message "The selected hosts will execute a build operation on next reboot"
- 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.
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

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.
cped to 3.4-stable 64e6bfc23015eb695e1a03d71c42abd626a9cdc2