Last active
February 2, 2018 01:56
-
-
Save wongster80/96c2f429b9e179c968ae82d156e2a9a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pillar looks like this: | |
mysql-configuration-settings: | |
global_buffers: | |
key_buffer_size: 8 | |
innodb_log_buffer_size: 8000 | |
innodb_additional_mem_pool_size: 8000 | |
net_buffer_length: 1000 | |
query_cache_size: 1000 | |
# State file computation looks like this: | |
{% set GLOBAL_BUFFERS_KB = 0 %} | |
{% for global_buffer in salt['pillar.get']('mysql-configuration-settings:global_buffers') %} | |
{% set GLOBAL_BUFFERS_KB = (GLOBAL_BUFFERS_KB + global_buffer) %} | |
{% endfor %} | |
# Error looks like this: | |
Data failed to compile: | |
---------- | |
Rendering SLS 'awong_dev_config:mysql' failed: Jinja error: unsupported operand type(s) for +: 'int' and 'str' | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 413, in render_jinja_tmpl | |
output = template.render(**decoded_context) | |
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render | |
return self.environment.handle_exception(exc_info, True) | |
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception | |
reraise(exc_type, exc_value, tb) | |
File "<template>", line 29, in top-level template code | |
TypeError: unsupported operand type(s) for +: 'int' and 'str' | |
; line 29 | |
--- | |
[...] | |
{% set MEMTOTAL_MB = salt['grains.get']('mem_total') %} | |
{% set INNODB_BUFFER_POOL_SIZE_GB = ((MEMTOTAL_MB * 0.75) / 1024)|round|int %} | |
{% set GLOBAL_BUFFERS_KB = 0 %} | |
{% for global_buffer in salt['pillar.get']('mysql-configuration-settings:global_buffers') %} | |
{% set GLOBAL_BUFFERS_KB = GLOBAL_BUFFERS_KB + global_buffer %} <====================== | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment