Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base argument to salt-ssh grains wrapper for filter_by func #33952

Merged
merged 1 commit into from
Jun 13, 2016

Conversation

rallytime
Copy link
Contributor

What does this PR do?

Adds the base kwarg to the grains.filter_by function in the salt-ssh wrapper.

What issues does this PR fix or reference?

Fixes #33911

Previous Behavior

root@rallytime:~# salt-ssh -i rally-ssh state.sls example
[ERROR   ] Rendering exception occurred: Jinja error: filter_by() got an unexpected keyword argument 'base'
Traceback (most recent call last):
  File "/root/SaltStack/salt/salt/utils/templates.py", line 366, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
TypeError: filter_by() got an unexpected keyword argument 'base'

; line 1

---
{% set test = salt['grains.filter_by']({    <======================
    'default': {'foo': 'bar'},
}, base='default') %}

test-it:
  file.managed:
[...]

---
[CRITICAL] Rendering SLS 'base:example' failed: Jinja error: filter_by() got an unexpected keyword argument 'base'
Traceback (most recent call last):
  File "/root/SaltStack/salt/salt/utils/templates.py", line 366, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
TypeError: filter_by() got an unexpected keyword argument 'base'

; line 1

---
{% set test = salt['grains.filter_by']({    <======================
    'default': {'foo': 'bar'},
}, base='default') %}

test-it:
  file.managed:
[...]

---
rally-ssh:
    - Rendering SLS 'base:example' failed: Jinja error: filter_by() got an unexpected keyword argument 'base'
      Traceback (most recent call last):
        File "/root/SaltStack/salt/salt/utils/templates.py", line 366, in render_jinja_tmpl
          output = template.render(**decoded_context)
        File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
          return self.environment.handle_exception(exc_info, True)
        File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
          reraise(exc_type, exc_value, tb)
        File "<template>", line 1, in top-level template code
      TypeError: filter_by() got an unexpected keyword argument 'base'

      ; line 1

      ---
      {% set test = salt['grains.filter_by']({    <======================
          'default': {'foo': 'bar'},
      }, base='default') %}

      test-it:
        file.managed:
      [...]
      ---

New Behavior

root@rallytime:~# salt-ssh -i rally-ssh state.sls example
rally-ssh:
----------
          ID: test-it
    Function: file.managed
        Name: /tmp/bar
      Result: True
     Comment: Empty file
     Started: 22:33:08.496032
    Duration: 45.968 ms
     Changes:
              ----------
              new:
                  file /tmp/bar created

Summary for rally-ssh
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1

Tests written?

No

@cachedout
Copy link
Contributor

Very nicely done!

@rallytime rallytime deleted the fix-33911 branch June 13, 2016 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants