-
Notifications
You must be signed in to change notification settings - Fork 16
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
Undocumented retries and inability to remove that functionality #15
Comments
@mschultz-aofl a question unrelated to the issue here, but related to your script. The |
I use packer to generate the shell script and toss it in that path, with the password in there. It's a restricted path, and the password is set per machine so it's not really sensitive. Not that the Packer I use resets the password to a known password - it doesn't use the reset script that's a part of this tool. So the setup is, within packer:
|
Hey @mschultz-aofl, thanks for opening this issue to track this. My first guess at what's happening is the logic behind ec2-macos-init's ec2-macos-init/lib/ec2macosinit/module.go Lines 154 to 166 in 79b17ea
I like your suggestion of adding a new config value to set the maximum number of attempts a module is run unsuccessfully. We'll need to do a bit more investigation into that addition as well as this issue as a whole. |
So I don't think it's there. If you look here: ec2-macos-init/lib/ec2macosinit/config.go Lines 93 to 105 in e83f1a6
You can see it retries 100 times. I think just modifying this would be the easiest thing to do. However, I'm not too familiar with Go - but as to why it does this, I think either (a) history isn't re-read/modified in memory, so the running process doesn't pick up the failure, or (b), the 100 retry logic bypasses ShouldRun. |
I don't that's the case for the module that you've provided as it sets You can double check this by seeing what's written in the log file
|
By default, the ec2-macos-init application will retry execution of failed sections. This doesn't appear documented anywhere, and can cause unexpected side effects. As an example, I have a script that configures MacOS certificates and registers the instance as a runner. As the line of my shell script failed came after registration, the machine registered itself with gitlab 101 times before finally stopping. This behavior needs to be modifiable and well documented, as it can cause serious side effects if not known.
Example TOML added:
And the shell script:
Note that
git lfs install
failed due to a missing $HOME env var, causing it to import the certificate many times and register itself with gitlab 100 times.My recommended fix would be to accept a 'RetryCount' option in the TOML to make this configurable, and explicitly set the default within the TOML, removing the const variable.
The text was updated successfully, but these errors were encountered: