When using the OpenStack client in the openstack "shell" mode, I miss aliases for common tasks a lot. I see that you can add aliases or macros with "alias add ..." or "macro add ...". However the aliases are not persisted between shell sessions. Is there some file where I can configure those ?
Asked
Active
Viewed 59 times
1 Answers
0
You could set persisted alias in /etc/profile or ~/.bashrc and others file in /etc/profile.d/.
- /etc/profile: set for all users
- ~/.bashrc: set for current user as
~
is the user$HOME
directory - /etc/profile.d/: where directory will be imported as
/etc/profile
shows:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
All this method take effect when you re login after update these files.

Victor Lee
- 2,467
- 3
- 19
- 37
-
If I'm not mistaken, you are talking about bash aliases. However those are not available in the OpenStack pseudo-shell. I could choose to not enter it and use my bash aliases instead (all beginning with "openstack ...", but establishing the keystone session is really time consuming. And I don't want to do that between each command. – Florentin Labelle May 22 '22 at 06:58
-
@FlorentinLabelle what will `openstack` alias to? Do you means exec `source /etc/kolla/admin-openrc.sh` before each command? – Victor Lee May 23 '22 at 04:02
-
When you use the OpenStack Cli, you have two options: either type each command independently "openstack server list", or you can just type "openstack" and then you enter some sort of shell (each line starts with "(openstack)" and then you can type your commands). In this "shell" (I really don't know how to describe it otherwise) bash (or zsh or fish) aliases don't apply. – Florentin Labelle May 23 '22 at 08:50
-
I know, I means what do you want to do about `alias`? What's your really requirement? – Victor Lee May 23 '22 at 12:59