ceph-salt
ceph-salt copied to clipboard
ceph-salt fails when yaml exceeds 1024 characters
Based on the character limitation described here, adding new minions fails with a pillar render error if the number of minions exceeds the total number of 1024 characters.
2024-05-16 09:58:54,321 [salt.pillar :1266][CRITICAL][8409] Pillar render error: Rendering Primary Top file failed, render error:
mapping values are not allowed here; line 8
---
[...]
base:
ses7-host2.fqdn,ses7-host3.fqdn,ses7-host4.fqdn,ses7-host1.fqdn,ses7-host5.fqdn,ses7-host6.fqdn,ses7-host7.fqdn,ses7-host8.fqdn,ses7-host9.fqdn,ses7-host10.fqdn,ses7-host11.fqdn,ses7-host12.fqdn,ses7-host13.fqdn,ses7-host14.fqdn,ses7-host15.fqdn,ses7-host16.fqdn,ses7-host17.fqdn,ses7-host18.fqdn,ses7-host19.fqdn,ses7-host20.fqdn,ses7-host21.fqdn,ses7-host22.fqdn,ses7-host23.fqdn,ses7-host24.fqdn,ses7-host25.fqdn,ses7-host26.fqdn,ses7-host27.fqdn,ses7-host28.fqdn,ses7-host29.fqdn,ses7-host30.fqdn,ses7-host31.fqdn,ses7-host32.fqdn,ses7-host33.fqdn,ses7-host34.fqdn,ses7-host35.fqdn,ses7-host36.fqdn,ses7-host37.fqdn,ses7-host38.fqdn,ses7-host39.fqdn,ses7-host40.fqdn: <======================
- match: list
- ceph-salt
The ceph-salt-top.sls content is generated here:
class PillarManager:
CS_TOP_FILE = "ceph-salt-top.sls"
CS_TOP_INCLUDE = "{% include 'ceph-salt-top.sls' %}"
CS_TOP_CONTENT = """{% import_yaml "ceph-salt.sls" as ceph_salt %}
{% set ceph_salt_minions = ceph_salt.get('ceph-salt', {}).get('minions', {}).get('all', []) %}
{% if ceph_salt_minions %}
{{ ceph_salt_minions|join(',') }}:
- match: list
- ceph-salt
{% endif %}
This modification seems to work:
{% set ceph_salt_minions = ceph_salt.get('ceph-salt', {}).get('minions', {}).get('all', []) %}
{% if ceph_salt_minions %}
{% for minion in ceph_salt_minions %}
{{ minion }}:
- ceph-salt
{% endfor %}
{% endif %}