mirror of
https://github.com/ben-grande/qusal.git
synced 2024-10-01 02:35:49 -04: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
|
||||
#}
|
||||
|
||||
{% set avoid = salt['cmd.shell']('qvm-ls --no-spinner --raw-list --tags whonix-updatevm') -%}
|
||||
|
||||
{% set exclude = salt['cmd.shell']('for qube in ' ~ avoid ~ '; do exclude="$exclude --exclude $qube"; done; echo "$exclude"') -%}
|
||||
|
||||
{% 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":
|
||||
{% set templates = salt['cmd.script']('salt://' ~ slsdotpath ~ '/files/admin/tag.sh') -%}
|
||||
{% for tpl in templates.stdout.split("\n") -%}
|
||||
"{{ slsdotpath }}-tag-for-{{ tpl }}":
|
||||
qvm.tags:
|
||||
- name: {{ tpl }}
|
||||
- add:
|
||||
|
Loading…
Reference in New Issue
Block a user