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

Wait until nodes connected before infra upgrade #122

Merged
merged 1 commit into from Sep 16, 2020

Conversation

reidmv
Copy link
Contributor

@reidmv reidmv commented Sep 16, 2020

Previously, it was observed several times that nodes might be in a state of disconnection from the orchestrator when peadm tries to perform a puppet infra upgrade operation. This commit implements a wait function to ensure that all nodes are orchestrator-connected before beginning a puppet infra upgrade operation.

Previously, it was observed several times that nodes might be in a state
of disconnection from the orchestrator when peadm tries to perform a
`puppet infra upgrade` operation. This commit implements a wait function
to ensure that all nodes are orchestrator-connected before beginning a
puppet infra upgrade operation.
@reidmv reidmv requested a review from a team as a code owner September 16, 2020 00:33
http = http_object
request = request_object(nodes: nodes, token_file: token_file)
inventory = {}
Timeout::timeout(timeout) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this article: https://medium.com/@adamhooper/in-ruby-dont-use-timeout-77d9d4e5a001 the dangers of Timeout::timeout are outlined. Is the worry that this code might raise for unexpected conditions justified?

Copy link
Contributor Author

@reidmv reidmv Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this code, we only care about the assignment operation to the variable inventory. The objective isn't to hard-lock execution time to a particular interval, it's just "stop trying after n seconds if you haven't succeeded". As such, I believe the behavior of Timeout here will not cause anything unexpected to happen. The worst-case scenario is that a hail-mary last-second possible success might not be counted if the code is interrupted after making an inventory request but before checking the results. That's okay. If it took that long to get a successful result, well, we exceeded the timeout. 🤷

@reidmv reidmv merged commit a475b88 into main Sep 16, 2020
@reidmv reidmv deleted the infra-wait-until-connected branch September 17, 2020 16:08
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.

None yet

2 participants