rcbops / openstack-ops

Tasks and Scripts written by the RPC Support team for use in RPC environments
Apache License 2.0
12 stars 24 forks source link

bash completion non-functional #148

Open rax-rstark opened 4 years ago

rax-rstark commented 4 years ago

Hello,

After running the playbook: https://github.com/rcbops/openstack-ops/blob/master/playbooks/configure-bash-environment.yml , I find that openstack bash completions do not function as expected. This issue appears to be due to the root user not sourcing /etc/profile.d/bash_completion.sh at login. Running source /etc/profile.d/bash_completion.sh from within utility container enables openstack bash completions to function as expected.

rax-rstark commented 4 years ago

So a little additional spelunking:

bash-completion is installed on utility container, which creates /etc/profile.d/bash_completion.sh. Upon login to utility container with /bin/bash as root user's shell I expect bash to read global /etc/profile and see that /etc/profile has an explicit call out to run *.sh within /etc/profile.d/ like so:

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

From the settings above, I would expect /etc/profile.d/bash_completion.sh would be ran by default upon interactive login. Despite the setup above, bash-completion is not working.

I can test default bash-completion functionality by logging into the container and running apt <tab><tab> to see if command completions are returned. By default, command completions are not returned. Manually running source /etc/profile.d/bash_completion.sh causes all bash-completions to subsequently function as expected. Completion commands tested: apt, cinder, glance, nova, heat, keystone, neutron, nova, and openstack

¯_(ツ)_/¯