-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
cargo fails to find standard homedir path for cargo binary #4407
Comments
Files identified in the description: If these files are incorrect, please update the |
Ansible looks in |
Yes ansible is ignoring the expanded path from the .bashrc and .profile (and this is how ansible normally works). Rustup puts a There is mention of this in the ansible cargo docs as working better with the hardcoded bin paths probably because of this issue. edit- This seems like a case where the module cargo should use something like -
So that the proper environment is found. |
Ansible does nowhere document that these files are loaded and/or interpreted. So why is this a bug? It is a mismatched expectation / missing feature (ability to specify extra paths where to look, diectly path to executable, or automatically add |
This module seems like a busy sysadmins trap. It doesn't detect the default install location for most peoples development environment (ie rustup based) that it's failing to find. It's also going to invoke cargo install (which does build things) without respecting the developer rust environment. There are many potential bugs by hardcoding things like this. Right now this module seems unsuitable for a developer workstation deploy. The module can work for people that only want to install ripgrep via an os installed cargo (thus bypassing the os installed ripgrep). I think I would have nacked this module until both the path and cargo respected the remote environment. But really it needs some rustup integration as well, as a big chunk of developer tooling is in rustup. - https://github.com/hurricanehrndz/ansible-rustup This following yaml was robust and useful in deploying a workstation
original source - https://waylonwalker.com/til/install-rust/#full-install-playbook |
I think implementing |
@radek-sprta I think that would solve the immediate issue but I'm not sure it will be correct in the medium term. When you run "~/.cargo/bin/cargo" or the found cargo directly its still going to ignore - https://doc.rust-lang.org/cargo/reference/environment-variables.html If you don't run cargo install within the shell environment. I have no idea who or in what circumstances would get future confusion or bugs. |
Whjen I get back from PTO, I'll take a look at implementing those. |
Files identified in the description: If these files are incorrect, please update the |
It's old, but searches brings here. My current workaround is to directly alter the PATH: - name: install rust stuff
environment:
PATH: "{{ansible_env.PATH}}:{{ ansible_env.HOME }}/.cargo/bin"
community.general.cargo:
name:
- ... It has the advantage of making it explicit which cargo I target (but for that I would prefer an |
Summary
the cargo module fails with -
TASK [Install tokei Rust package] *************************************************************************************************************************** fatal: [hostname]: FAILED! => {"changed": false, "msg": "Failed to find required executable \"cargo\" in paths: /usr/local/bin:/usr/bin:/bin:/usr/games:/sbin:/usr/sbin:/usr/local/sbin"}
cargo executable is located in default rustup install location
/home/username/.cargo/bin/
Issue Type
Bug Report
Component Name
cargo
Ansible Version
Community.general Version
Configuration
OS / Environment
Debian Bookworm targeting Bookworm
Steps to Reproduce
Run this module against home directory with the default rustup install location.
Expected Results
cargo installs the package
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: