saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

The documentation is incorrectly compiled (PILLAR section) #42405

Closed felrivero closed 7 years ago

felrivero commented 7 years ago

Description of Issue/Question

Hello everyone, I'm studying salt, one of the steps is pillars ( https://docs.saltstack.com/en/latest/topics/tutorials/pillar.html#pillar-walk-through ) After completing the steps from the section "PILLAR MAKES SIMPLE STATES GROW EASILY" salt '*' state.apply edit.vim returns: Rendering SLS 'base:edit.vim' failed: Jinja variable 'salt.pillar object' has no attribute 'vimrc'

The steps described above worked fine (above section "PILLAR MAKES SIMPLE STATES GROW EASILY")

Setup

Master config default (path default /srv/salt and /srv/pillar)

├── pillar
│   └── edit
│       └── vim.sls
└── salt
    └── edit
        ├── dev_vimrc
        ├── qa_vimrc
        ├── vimrc
        └── vim.sls

Steps to Reproduce Issue

The contents of files according to the section "PILLAR MAKES SIMPLE STATES GROW EASILY" ( https://docs.saltstack.com/en/latest/topics/tutorials/pillar.html#pillar-walk-through ) /srv/salt/edit/vim.sls

vim:
  pkg.installed:
    - name: {{ pillar['pkgs']['vim'] }}

/etc/vimrc:
  file.managed:
    - source: {{ pillar['vimrc'] }}
    - mode: 644
    - user: root
    - group: root
    - require:
      - pkg: vim

/srv/pillar/edit/vim.sls

{% if grains['id'].startswith('dev') %}
vimrc: salt://edit/dev_vimrc
{% elif grains['id'].startswith('qa') %}
vimrc: salt://edit/qa_vimrc
{% else %}
vimrc: salt://edit/vimrc
{% endif %}

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Debian 8
salt-master                    2017.7.0+ds-1
salt-minion                    2017.7.0+ds-1
salt --versions-report
Salt Version:
           Salt: 2017.7.0

Dependency Versions:
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 2.2
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.8
         locale: UTF-8
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.8
garethgreenaway commented 7 years ago

@felrivero Thanks for the report. Looking at the pillar documentation that you linked to, it looks like the pillar values that you're missing are referenced in the section just above the one you mentioned, "PARAMETERIZING STATES WITH PILLAR".

garethgreenaway commented 7 years ago

@felrivero Apologies, misread the issue report. I believe the piece that you're missing, which is missing from the documentation, is that you need to include the edit.vim pillar values in the /srv/pillar/top.sls: file, similar to how the data, user and pkg pillar files were included.

felrivero commented 7 years ago

Thanks edit.vim in top.sls works, it was a little unobvious for me, I will correct myself.

rallytime commented 7 years ago

@felrivero I have added this information to the pillar tutorial in PR #42516. Thanks for letting us know!

cachedout commented 7 years ago

Closed via #42516