fix: ignore extraneous Erlang output during when CLI installation #487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
As part of supporting Ubuntu 22 ARM in agent-aws-stack, we reached an issue with the when CLI installation. For some reason, the erl command used to determine the version of Erlang/OTP returns some junk and not only the version we are interested in:
Due to that, the
ERLANG_VERSION
variable ends up having some spaces in it, so themv
command here ends up being expanded to a move command that tries to move multiple files. Since moving multiple files, themv
command expects the last argument to be a directory, the when CLI fails to be installed with thecannot access '/usr/local/bin/when': No such file or directory
error message.Weirdly enough, that only happens when the install script runs as part of an Ansible task, and not in all cases - for example, if the
install-toolbox
toolbox script is run separately from theinstall.sh
agent installation script, it works just fine. Also, if I run that command through any other means, I don't see those errors.Ref: https://github.com/renderedtext/tasks/issues/7932
Solution
I couldn't find a reasonable explanation of why Erlang shows these errors inconsistently (only during Ansible task when the script runs as part of another script invocation), so I think the best route forward here is to update the
install-toolbox
script to just ignore that extra output.