mirror of
https://github.com/ben-grande/qusal.git
synced 2025-02-23 08:19:47 -05:00
fix: better output for cacher tag assignment
This commit is contained in:
parent
71d22c54b6
commit
a78b90e8bd
15
salt/sys-cacher/files/admin/tag.sh
Executable file
15
salt/sys-cacher/files/admin/tag.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
exclude="$(qvm-ls --no-spinner --raw-list --tags whonix-updatevm \
|
||||||
|
| sed "s/^./--exclude &/" | tr "\n" " ")"
|
||||||
|
|
||||||
|
wanted="$(qvm-ls --no-spinner --raw-data --fields=NAME,CLASS --all ${exclude} \
|
||||||
|
| awk -v class="TemplateVM" -F "|" '$2 ~ class {print $1}')"
|
||||||
|
|
||||||
|
echo "${wanted}"
|
@ -4,14 +4,9 @@ SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|||||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
#}
|
#}
|
||||||
|
|
||||||
{% set avoid = salt['cmd.shell']('qvm-ls --no-spinner --raw-list --tags whonix-updatevm') -%}
|
{% set templates = salt['cmd.script']('salt://' ~ slsdotpath ~ '/files/admin/tag.sh') -%}
|
||||||
|
{% for tpl in templates.stdout.split("\n") -%}
|
||||||
{% set exclude = salt['cmd.shell']('for qube in ' ~ avoid ~ '; do exclude="$exclude --exclude $qube"; done; echo "$exclude"') -%}
|
"{{ slsdotpath }}-tag-for-{{ tpl }}":
|
||||||
|
|
||||||
{% set wanted = salt['cmd.shell']('qvm-ls --no-spinner --raw-data --fields=NAME,CLASS --all ' ~ exclude ~ ' | awk -F "|" "/|TemplateVM|/{print $1}"') -%}
|
|
||||||
|
|
||||||
{% for tpl in wanted -%}
|
|
||||||
"{{ tpl }}-cacher-tag":
|
|
||||||
qvm.tags:
|
qvm.tags:
|
||||||
- name: {{ tpl }}
|
- name: {{ tpl }}
|
||||||
- add:
|
- add:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user