Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of template: allow change_mode script to run after client restart into release/1.8.x #23676

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #23663 to be assessed for backporting due to the inclusion of the label backport/1.8.x.

The below text is copied from the body of the original PR.


For templates with change_mode = "script", we set a driver handle in the poststart method, so the template runner can execute the script inside the task. But when the client is restarted and the template contents change during that window, we trigger a change_mode in the prestart method. In that case, the hook will not have the handle and so returns an errror trying to run the change mode.

We restore the driver handle before we call any prestart hooks, so we can pass that handle in the constructor whenever it's available. In the normal task start case the handle will be empty but also won't be called.

The error messages are also misleading, as there's no capabilities check happening here. Update the error messages to match.

Fixes: #15851
Ref: https://hashicorp.atlassian.net/browse/NET-9338


Overview of commits

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/b-changemode-script-fail/lively-romantic-katydid branch from 428cc83 to 5ababef Compare July 24, 2024 12:30
@vercel vercel bot temporarily deployed to Preview – nomad-ui July 24, 2024 12:33 Inactive
@tgross tgross merged commit b41002e into release/1.8.x Jul 24, 2024
18 of 20 checks passed
@tgross tgross deleted the backport/b-changemode-script-fail/lively-romantic-katydid branch July 24, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants