yaml anchors disable

This commit is contained in:
Ivan Panteleev 2021-04-20 20:47:46 +03:00
parent 70f5e07327
commit 96f423a396

View File

@ -3,6 +3,10 @@
from salt.utils import dictupdate
import yaml
class NoAliasDumper(yaml.SafeDumper):
def ignore_aliases(self, data):
return True
conf_path = '/etc/elasticsearch/'
log_path = '/var/log/elasticsearch/'
data_path = '/var/lib/elasticsearch/'
@ -26,7 +30,7 @@ File.directory(
fqdn = grains('fqdn')
fqdn_ipv6 = grains('fqdn_ipv6')
nodes = pillar('elastic:nodes', {})
master_nodes = nodes.get('master', {})
master_nodes = nodes.get('master', [])
if not 'data' in nodes:
nodes['data'] = master_nodes
if not 'ingest' in nodes:
@ -126,7 +130,7 @@ dictupdate.update(config, pillar('elastic:config'))
File.managed(
conf_path + 'elasticsearch.yml',
mode=644, user='root', group='root',
contents="# This file is generated by Salt\n" + yaml.dump(config),
contents="# This file is generated by Salt\n" + yaml.dump(config, Dumper=NoAliasDumper),
require=[File(conf_path)])
File.managed(