openstackclient is so slow and inconsistent.
It requires too much maintenance and monkey typing.
Well, no
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gtema/openstack/releases/latest/download/openstack_cli-installer.sh | sh
docker pull ghcr.io/gtema/openstack:0.13.0
cargo install openstack_cli
osc <service> <resource> <subresource> [--parameters] <operation>
osc <service> help
--current-user|--user-id|--user-name--current-project|--project-id|--project-nameExplicit authentication commands
osc auth showosc --os-cloud devstack auth showTOKEN=$(osc auth login)osc auth login --renew| Command | Description |
|---|---|
osc ... |
Use $OS_CLOUD env or prompt user |
osc ... --os-cloud |
Request explicit cloud from clouds.yaml |
osc ... --os-cloud --os-project-name |
Override project scope keeping identity info |
osc ... --os-client-config-file |
Alternative path to clouds.yaml |
osc --cloud-config-from-env |
No ?? for unexpected results |
osc .. --auth-helper-cmd ./vault_read.sh |
helper to extract secrets from wherever. |
OS_CLIENT_CONFIG_PATH=~/private.yaml:~/work.yaml` |
Combine multiple configs into single virtual tree |
auth_type: [v3websso,v4oidc,v4passkey,v4jwt] |
All "fancy" auth methods |
Different ways to output the data
osc auth show -o json
osc auth show -o json --pretty
osc auth show -o json | jq '.token.user'
osc catalog list -o json | jq '.[] | select(.type=="identity")'
osc compute flavor list -o wide
osc compute flavor list -f id -f name
osc compute flavor list --table-arrangement dynamic-full-width
Send authenticated API requests
osc api --help
osc api <SERVICE_TYPE> <URL> [-m <METHOD>] [-H <HEADER>]
osc --os-cloud devstack-admin api identity /identity/v3/projects --pretty
ls ~/.osc
For resources with the `state` column results are colored.
osc image image list
$XDG_CONFIG_HOME/osc/[config,views].yamlviews:
compute.server:
default_fields: [id, name, status, created, address, image, flavor, security_groups]
fields:
- name: id
width: 38
- name: hostId
width: 38
- name: flavor
json_pointer: "/original_name"
- name: image
json_pointer: "/id"
...
command_hints:
auth:
show:
- "Auth token can be set to the shell variable with `TOKEN=$(osc auth login)`"
- "A full authentication response can be seen with `osc auth show -o json --pretty`"
object-store.object:
delete:
- "Container can be pruned with `osc object-store container prune [--prefix <PREFIX>] <CONTAINER>`"
...curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gtema/openstack/releases/latest/download/openstack_tui-installer.sh | sh
ostui
ostui --os-cloud XXX
Similarly to the OSC supports views customization
$XDG_CONFIG_HOME/openstack_tui/[config,views].yaml
# Mode keybindings in the following form
# <Mode>:
# <shortcut>:
# action: <ACTION TO PERFORM>
# description: <DESCRIPTION USED IN TUI>
mode_keybindings:
# Block Storage views
BlockStorageBackups:
"y":
action: DescribeApiResponse
description: YAML
ComputeServers:
"0":
action:
SetComputeServerListFilters: {}
description: Default filters
type: Filter
"1":
action:
SetComputeServerListFilters: {"all_tenants": "true"}
description: All tenants (admin)
type: Filter
"ctrl-d":
action: DeleteComputeServer
description: Delete
"c":
action: ShowServerConsoleOutput
description: Console output
......
global_keybindings:
"F1":
action:
Mode:
mode: Home
stack: false
description: Home
"F2":
action: CloudSelect
description: Select cloud
":":
action: ApiRequestSelect
description: Select resource
"<F4>":
action: SelectProject
description: Select project
"<ctrl-r>":
action: Refresh
description: Reload data
......
# Mode aliases
# <ALIAS>: <MODE>
mode_aliases:
"aggregates (compute)": "ComputeAggregates"
"application credentials (identity)": "IdentityApplicationCredentials"
"backups": "BlockStorageBackups"
"flavors": "ComputeFlavors"
views:
# Block Storage
block_storage.backup:
default_fields: [id, name, az, size, status, created_at]
compute.server:
default_fields: [id, name, flavor, status, created, updated]
fields:
- name: flavor
json_pointer: "/original_name"Thank you for the attention!