Variable COMPOSE_PLUGIN_PATH not set in bash_completion.d/docker script
pypb opened this issue · comments
In the bash completion script ~/.bash_completion.d/docker a variable COMPOSE_PLUGIN_PATH is being set by running docker info
, which is used to setup completion for docker compose
. This command fails due to the completion scripts being sourced before the user PATH has been setup.
On Ubuntu 22.04 completion is first sourced from /etc/profile.d/bash_completion.sh before the users .bashrc, and then again from ~/.bash_completion setup by the role. Both of them is being sourced before the PATH set in the Ansible managed block.
This is visible when logging in as the docker user:
# su - docker
-bash: docker: command not found
-bash: docker: command not found
docker@myhost:~$
If I re-order the Ansible managed block in .bashrc, putting it on the top of the file, the second run (sourced from .bashrc) works:
# su - docker
-bash: docker: command not found
docker@myhost:~$
The second sourcing could be fixed by re-ordering the tasks adding to .bashrc, but I'm unsure how to best tackle the first one. Perhaps modifying the completion-script, using some other method to locate the compose plugin.
Hi again @pypb, I'll have a look