Bash completion for oc command does not work
環境
- Red Hat Enterprise Linux (RHEL) 7.4
- Red Hat OpenShift Linux Client (oc) v3.6.173.0.21
問題
- Bash completion for
occommand does not work. Pressing tab key afterocdoes not show openshift client command parameters.
解決策
- When deploying the Openshift Linux client from
tar.gzarchive, user should manually generate the completion script forbashwith the following command:
# oc completion bash >>/etc/bash_completion.d/oc_completion
- The output file can be saved in user local directory and sourced from
~/.bashrcfile as well.
Note: Ensure bash-completion package is already present on the system in order to get oc bash completions working.
原因
OpenShift Linux Client /usr/bin/oc can be installed from atomic-openshift-clients.rpm package or simply extracted from tar.gz archive to any user directory.
The package version contains manual pages and bash completion script which is installed in default location: /etc/bash_completion.d/oc while only a single executable file is available in the archive version.
診断手順
With autocompletion enabled the shell presents oc supported commands:
# oc
adm completion describe get new-app process rsync tag
annotate config edit idle new-build project run types
apply convert env import new-project projects scale version
attach cp exec import-image observe proxy secrets volumes
auth create explain label options replace serviceaccounts whoami
autoscale debug export login patch rollback set
cancel-build delete expose logout policy rollout start-build
cluster deploy extract logs port-forward rsh status
このソリューションは、Red Hat のエンジニアがお客様のサポート中に作成したナレッジコンテンツの大型ライブラリーを提供する Fast-Track Publication Program の一環です。お客様が必要とする知識・情報を即時に提供するために、これらの記事は、未処理・未編集の状態で提示される場合がありますので、予めご了承ください。
コメント