aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorGeert Stappers <stappers@stappers.it>2023-01-09 19:18:40 +0100
committerGitHub <noreply@github.com>2023-01-09 10:18:40 -0800
commitd20143854cb65e86f39c49a8109fd03612c2044f (patch)
tree67365e926c8cc7a388ffdaead6425c94b6e61fdb /internal
parentbdf7df6d7be8bb887334d3b623c999c9adc06843 (diff)
style: add clarifying comments in polling iPXE scripts
* String changes in internal/polling/polling.go The most important one, from the point of view of human user, is the addition of telling that a maximum retry has been reached. The poll script got rid of the way too long line. That is done by using "iPXE script continueing line character", \, backslash. Poll interval shorter, from ten seconds to seven seconds, also from 10000 ms to more readable 7000 ms (clearly three zeros (how many zeros are in 10000? (four or five?))). Added information about a loop that only looks like a loop. A minor `s/iPXE/iPXE client/`. In directory test/integ-test/expected-results/ are poll-unknown.txt and poll.txt updated for getting a clean `make test`. * style: build on top of latest contribution In particular, mentioning 'maxRetry' exposes implementation code to the end user, which we should avoid. Co-authored-by: Raul Benencia <raul@thousandeyes.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/polling/polling.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/polling/polling.go b/internal/polling/polling.go
index cfd489f..7b1235b 100644
--- a/internal/polling/polling.go
+++ b/internal/polling/polling.go
@@ -42,16 +42,20 @@ const (
"#\n" +
"# Do\n" +
"# curl http://{{.baseURL}}/poll/1/06-66-de-ad-be-ef\n" +
- "# to get an idea about what iPXE will receive.\n"
+ "# to get an idea about what the iPXE client will receive.\n"
maxRetry = 10
retryScript = "#!ipxe\n" +
- "prompt --key 0x02 --timeout 10000 shoelaces: Press Ctrl-B for manual override... && " +
- "chain -ar http://{{.baseURL}}/ipxemenu || " +
- "chain -ar http://{{.baseURL}}/poll/1/{{.macAddress}}\n"
+ "prompt --key 0x02 --timeout 7000 shoelaces: Press Ctrl-B for manual override... \\\n" +
+ " && chain -ar http://{{.baseURL}}/ipxemenu \\\n" +
+ " || chain -ar http://{{.baseURL}}/poll/1/{{.macAddress}}\n\n" +
+ "# Note: the iPXE client will see the above code as an endless loop.\n" +
+ "# However, Shoelaces will break that loop after a fixed number of retries.\n"
timeoutScript = "#!ipxe\n" +
+ "echo\n" +
+ "echo Shoelaces reached the maximum number of retries\n" +
"exit\n"
// BootAction is used when a user selects a script for the polling
nihil fit ex nihilo