saltstack-formulas / mysql-formula

Install the MySQL client and/or server
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
85 stars 369 forks source link

Last Update BUG #255

Open preussal opened 3 years ago

preussal commented 3 years ago

After the update "Merge branch 'master' into master" there is an error https://github.com/saltstack-formulas/mysql-formula/commit/9bc73338f26ce5ab2652062b2842cb603135cf7f

[ERROR   ] Rendering exception occurred
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 498, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 23, in top-level template code
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'startswith'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 260, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 505, in render_jinja_tmpl
    raise SaltRenderError("Jinja variable {}{}".format(exc, out), buf=tmplstr)
salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'startswith'
[CRITICAL] Rendering SLS 'base:mysql.server' failed: Jinja variable 'dict object' has no attribute 'startswith'

Change in mysql/server.sls the line From elif mysql.server.startswith('percona-server-server') %} to elif mysql.server.startswith is defined and mysql.server.startswith('percona-server-server') %}

then it works

noelmcloughlin commented 3 years ago

Can you raise PR please?

myii commented 3 years ago

@noelmcloughlin This isn't a simple fix as mentioned above. This regression has been introduced by the merge of #185, which was actually based around mysql being the following (as opposed to the whole map):

{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}

This version of the file is from around that time:

https://github.com/saltstack-formulas/mysql-formula/blob/25375839d8f54ae07a149164461998281898f028/mysql/server.sls#L6