The completion function used a hard coded reference to $HOME of the user
who originally executed the command. This meant that if the root user
executed oc-cluster completion bash the profiles variable would be
assigned to the base names in /root/.oc/profiles/.
This change utilizes the environment variable OPENSHIFT_HOME_DIR and
OPENSHIFT_PROFILES_DIR and if not set, assigns them in the same manner
that oc-cluster itself does. This allows the completion script to work
on a multi-user machine or when invoked by the root user for the purpose
of writing the output to /etc/bash_completion.d/oc-cluster.bash.
The completion function used a hard coded reference to $HOME of the user who originally executed the command. This meant that if the root user executed
oc-cluster completion bash
the profiles variable would be assigned to the base names in/root/.oc/profiles/
.This change utilizes the environment variable OPENSHIFT_HOME_DIR and OPENSHIFT_PROFILES_DIR and if not set, assigns them in the same manner that oc-cluster itself does. This allows the completion script to work on a multi-user machine or when invoked by the root user for the purpose of writing the output to /etc/bash_completion.d/oc-cluster.bash.