From 7b50e1766e1a4430409b7c5584dc211e6031079d Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 3 Jun 2016 13:49:51 -0600 Subject: [PATCH] Better fix Just use opts grains int he loader and fall back to empty dict --- salt/loader.py | 3 ++- salt/renderers/jinja.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/loader.py b/salt/loader.py index 62124e827f..7e85eae3a1 100644 --- a/salt/loader.py +++ b/salt/loader.py @@ -565,7 +565,8 @@ def render(opts, functions, states=None): ''' Returns the render modules ''' - pack = {'__salt__': functions} + pack = {'__salt__': functions, + '__grains__': opts.get('grains', {})} if states: pack['__states__'] = states ret = LazyLoader( diff --git a/salt/renderers/jinja.py b/salt/renderers/jinja.py index b214b0847c..7a9452368d 100644 --- a/salt/renderers/jinja.py +++ b/salt/renderers/jinja.py @@ -367,11 +367,10 @@ def render(template_file, saltenv='base', sls='', argline='', raise SaltRenderError( 'Unknown renderer option: {opt}'.format(opt=argline) ) - tmp_data = salt.utils.templates.JINJA(template_file, to_str=True, salt=_split_module_dicts(), - grains=__opts__['grains'], + grains=__grains__, opts=__opts__, pillar=__pillar__, saltenv=saltenv,