Coder Social home page Coder Social logo

salt_grains_issue's Introduction

Steps

  1. Change directory into root of this repository
  2. Change root_dir, file_roots, pillar_roots in ./master/etc/salt/master to the correct paths on your machine
  3. Change root_dir in ./minion/etc/salt/minion to the correct paths on your machine
  4. Run master salt-master -c ./master/etc/salt/
  5. Run minion salt-minion -c ./minion/etc/salt/
  6. Accept minion key on master salt-key -c ./master/etc/salt/ -A
  7. Apply minion state: salt-call -c ./minion/etc/salt/ state.apply

Expected output

$ cat ./minion/test_file
qa1db.example.com

Log output

---
2017-01-25 15:13:35,306 [salt.pillar      ][CRITICAL][24815] Rendering SLS 'qa' failed, render error:
Jinja error: unsupported operand type(s) for +: 'NoneType' and 'str'
Traceback (most recent call last):
  File "/Users/tobi/salt/salt/utils/templates.py", line 355, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/Users/tobi/salt/env/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/tobi/salt/env/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

; line 1

---
test_pillar: {{ grains.get('role') + 'db.example.com' }}    <======================

Traceback (most recent call last):
  File "/Users/tobi/salt/salt/utils/templates.py", line 355, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/Users/tobi/salt/env/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
[...]
---
2017-01-25 15:13:35,307 [salt.pillar      ][CRITICAL][24815] Pillar render error: Rendering SLS 'qa' failed. Please see master log for details.

Observations

Adding the following to ./master/etc/salt/master silences the error, but then uses the grain of the master and not the minion:

grains:
  role: master

Leading to the, with my understanding, incorrect:

$ cat ./minion/test_file
masterdb.example.com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.