mirror of
https://github.com/ben-grande/qusal.git
synced 2024-12-23 14:39:23 -05:00
feat: helper to show mgmt property information
For: https://github.com/ben-grande/qusal/issues/69
This commit is contained in:
parent
620fa10a69
commit
e9801c8535
10
.github/ISSUE_TEMPLATE/bug.md
vendored
10
.github/ISSUE_TEMPLATE/bug.md
vendored
@ -29,8 +29,12 @@ invalid.
|
||||
|
||||
### Software version
|
||||
<!--
|
||||
You must specify as much information as possible in this category.
|
||||
You can also specify the base commit of the project.
|
||||
You must specify as much information as possible in this category. The
|
||||
commands shown below are the minimum.
|
||||
Share the base commit of the project:
|
||||
$ git rev-parse HEAD
|
||||
Share information about the Salt management qube structure:
|
||||
https://github.com/ben-grande/qusal/blob/main/docs/TROUBLESHOOT.md#get-salt-management-information
|
||||
-->
|
||||
|
||||
|
||||
@ -57,7 +61,7 @@ settings manually, this should also be mentioned.
|
||||
|
||||
### Expected behavior
|
||||
<!--
|
||||
What where you expecting to have happened? Why where you expecting that?
|
||||
What where you expecting to have happened? Why were you expecting that?
|
||||
-->
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ Qusal troubleshooting guidelines.
|
||||
* [Detect if your issue was already opened](#detect-if-your-issue-was-already-opened)
|
||||
* [Qrexec client shows Request refused](#qrexec-client-shows-request-refused)
|
||||
* [Salt wrapper qubesctl command fails](#salt-wrapper-qubesctl-command-fails)
|
||||
* [Get Salt management information](#get-salt-management-information)
|
||||
|
||||
## Detect if your issue was already opened
|
||||
|
||||
@ -69,3 +70,16 @@ Ending the Salt call with `-l debug` argument gives the most detailed output
|
||||
```
|
||||
sudo qubesctl state.apply pkg.uptodate -l debug
|
||||
```
|
||||
|
||||
## Get Salt management information
|
||||
|
||||
Depending on the operating system of the `management_dispvm`, Salt can fail.
|
||||
Let's gather some information about it.
|
||||
|
||||
Get information about the global `management_dispvm` and the same property of
|
||||
a specific qube. In this example we use `tpl-qubes-builder`, substitute for
|
||||
the qube being managed:
|
||||
```sh
|
||||
sudo qubesctl state.apply dom0.helpers
|
||||
qvm-mgmt tpl-qubes-builder
|
||||
```
|
||||
|
46
salt/dom0/files/bin/qvm-mgmt
Executable file
46
salt/dom0/files/bin/qvm-mgmt
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
set -eu
|
||||
|
||||
usage(){
|
||||
echo "Usage: ${0##*/} QUBE" >&2
|
||||
exit "${1:-1}"
|
||||
}
|
||||
|
||||
get_qube_feat(){
|
||||
qube="${1}"
|
||||
qvm-features "${qube}" \
|
||||
| grep -e os-distribution -e os-version -e template-release \
|
||||
-e template-release -e template-name
|
||||
}
|
||||
|
||||
case "${1-}" in
|
||||
-h|--?help) usage 0;;
|
||||
-*|"") usage 1;;
|
||||
*) wanted_qube="${1}";;
|
||||
esac
|
||||
|
||||
mgmt="$(qubes-prefs management_dispvm)"
|
||||
echo "Global management_dispvm qube: ${mgmt}"
|
||||
tpl_mgmt="$(qvm-prefs "${mgmt}" template)"
|
||||
echo "Global management_dispvm template: ${tpl_mgmt}"
|
||||
echo "Global management_dispvm template features:"
|
||||
get_qube_feat "${tpl_mgmt}"
|
||||
|
||||
if ! qvm-check -q -- "${wanted_qube}"; then
|
||||
echo "error: qube '${wanted_qube}' does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Wanted qube: ${wanted_qube}"
|
||||
wanted_mgmt="$(qvm-prefs "${wanted_qube}" management_dispvm)"
|
||||
echo "Global management_dispvm qube: ${wanted_mgmt}"
|
||||
if test "${wanted_mgmt}" = "${mgmt}"; then
|
||||
exit
|
||||
fi
|
||||
wanted_tpl_mgmt="$(qvm-prefs "${wanted_mgmt}" template)"
|
||||
echo "Global management_dispvm template: ${wanted_tpl_mgmt}"
|
||||
echo "Global management_dispvm template features:"
|
||||
get_qube_feat "${wanted_tpl_mgmt}"
|
0
salt/dom0/files/bin/qvm-port-forward
Normal file → Executable file
0
salt/dom0/files/bin/qvm-port-forward
Normal file → Executable file
@ -35,4 +35,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- group: root
|
||||
- makedirs: True
|
||||
|
||||
"{{ slsdotpath }}-mgmt-debug-helper":
|
||||
file.managed:
|
||||
- name: /usr/local/bin/qvm-mgmt
|
||||
- source: salt://{{ slsdotpath }}/files/bin/qvm-mgmt
|
||||
- mode: "0755"
|
||||
- user: root
|
||||
- group: root
|
||||
- makedirs: True
|
||||
|
||||
{% endif -%}
|
||||
|
Loading…
Reference in New Issue
Block a user