salt icon indicating copy to clipboard operation
salt copied to clipboard

masterless minion can't call pillar.item from pillar stack (development branch)

Open aboe76 opened this issue 10 years ago • 17 comments

Description of Issue/Question

masterless minion from development branch can't find pillar data from stack command: salt-call pillar.item salt won't return pillar data.

running salt-minion from 2016.3.4 works as it should.

Setup

salt minion running masterless with the following configuration:

master_type: "disable"
file_client: local
pillar_roots:
  base:
    - /srv/pillar
    - /srv/spm/pillar
ext_pillar:
  - stack: /srv/pillar/stack/stack.cfg
pillar_merge_lists: true

Steps to Reproduce Issue

configure salt minion with ext_pillar stack with some items, run salt-call pillar.item key

Versions Report

salt-minion with issues:

Salt Version:
           Salt: 2016.11.0-367-g15c4081
 
Dependency Versions:
           cffi: 1.8.3
       cherrypy: 8.1.2
       dateutil: 2.6.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: 1.6.5
         Jinja2: 2.8
        libgit2: 0.24.2
        libnacl: 1.5.0
       M2Crypto: 0.24.0
           Mako: 1.0.6
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.17
       pycrypto: 2.6.1
         pygit2: 0.24.2
         Python: 2.7.12 (default, Nov  7 2016, 11:55:55)
   python-gnupg: 0.3.9
         PyYAML: 3.12
          PyZMQ: 16.0.0
           RAET: 0.6.5
          smmap: Not Installed
        timelib: 0.2.4
        Tornado: 4.4.2
            ZMQ: 4.1.5
 
System Versions:
           dist:   
        machine: x86_64
        release: 4.8.7-1-ARCH
         system: Linux
        version: Not Installed

working salt-minion setup:

Salt Version:
           Salt: 2016.3.4
 
Dependency Versions:
           cffi: 1.8.3
       cherrypy: 8.1.2
       dateutil: 2.6.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: 1.6.5
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: 1.5.0
       M2Crypto: 0.24.0
           Mako: 1.0.6
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: 1.2.5
      pycparser: 2.17
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov  7 2016, 11:55:55)
   python-gnupg: 0.3.9
         PyYAML: 3.12
          PyZMQ: 16.0.0
           RAET: 0.6.5
          smmap: Not Installed
        timelib: 0.2.4
        Tornado: 4.4.2
            ZMQ: 4.1.5
 
System Versions:
           dist:   
        machine: x86_64
        release: 4.8.7-1-ARCH
         system: Linux
        version: Not Installed

aboe76 avatar Nov 15 '16 22:11 aboe76

Can you give me a set of pillars that this works with on 2016.3.4?

I tested with the following

==> /srv/pillar/common.yml <==
users:
  tom:
    uid: 500
    roles:
      - sysadmin
  root:
    uid: 0

==> /srv/pillar/server.yml <==
users:
  tom:
    uid: 1000
    roles:
      - developer
  mat:
    uid: 1001

==> /srv/pillar/stack/stack.cfg <==
common.yml
server.yml

==> /etc/salt/minion <==
master_type: "disable"
file_client: local
pillar_roots:
  base:
    - /srv/pillar
ext_pillar:
  - stack: /srv/pillar/stack/stack.cfg
pillar_merge_lists: true

And couldn't get it to work on either 2016.3.4 or 2016.11 ...

Also, from the documentation page about this, the creator has requested that all issues about pillarstack be opened on https://github.com/bbinet/pillarstack/issues

gtmanfred avatar Nov 16 '16 17:11 gtmanfred

nevermind, i got it working, moved the yml files into the stack/ directory

gtmanfred avatar Nov 16 '16 17:11 gtmanfred

@gtmanfred the yaml files need be in the stack folder

aboe76 avatar Nov 16 '16 17:11 aboe76

😁

aboe76 avatar Nov 16 '16 17:11 aboe76

It is working on the latest develop installed via pip here.

[root@49702b21d07a pillar]# salt-call pillar.items -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: 49702b21d07a
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[INFO    ] Could not determine init system from command line: (/bin/bash)
[DEBUG   ] The `lspci` binary is not available on the system. GPU grains will not be available.
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded pillar.items
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded stack.ext_pillar
[DEBUG   ] Config: /srv/pillar/stack/stack.cfg
[DEBUG   ] YAML: basedir=/srv/pillar/stack, path=common.yml
[DEBUG   ] YAML: basedir=/srv/pillar/stack, path=server.yml
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
    users:
        ----------
        mat:
            ----------
            uid:
                1001
        root:
            ----------
            uid:
                0
        tom:
            ----------
            roles:
                - sysadmin
                - developer
            uid:
                1000
[root@49702b21d07a pillar]# salt-call --versions-report
Salt Version:
           Salt: 2016.11.0rc2-1215-g9fc2cee

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Sep 15 2016, 22:37:39)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.1.6

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 4.4.24-boot2docker
         system: Linux
        version: CentOS Linux 7.2.1511 Core

Here is the docker container if you wanna test it 😄 gtmanfred/issues:37713

$ docker run -ti --rm gtmanfred/issues:37713 salt-call pillar.items
local:
    ----------
    users:
        ----------
        mat:
            ----------
            uid:
                1001
        root:
            ----------
            uid:
                0
        tom:
            ----------
            roles:
                - sysadmin
                - developer
            uid:
                1000
$ docker run -ti --rm gtmanfred/issues:37713 salt-call --versions-report
Salt Version:
           Salt: 2016.11.0rc2-1215-g9fc2cee

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Sep 15 2016, 22:37:39)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.1.6

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 4.4.24-boot2docker
         system: Linux
        version: CentOS Linux 7.2.1511 Core

gtmanfred avatar Nov 16 '16 17:11 gtmanfred

I still have issues:

alt-call --versions-report
Salt Version:
           Salt: 2016.11.0-389-g9fc2cee

Dependency Versions:
           cffi: 1.8.3
       cherrypy: 8.1.2
       dateutil: 2.6.0
          gitdb: 0.6.4
      gitpython: Not Installed
          ioflo: 1.6.5
         Jinja2: 2.8
        libgit2: 0.24.2
        libnacl: 1.5.0
       M2Crypto: 0.24.0
           Mako: 1.0.6
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.17
       pycrypto: 2.6.1
         pygit2: 0.24.2
         Python: 2.7.12 (default, Nov  7 2016, 11:55:55)
   python-gnupg: 0.3.9
         PyYAML: 3.12
          PyZMQ: 16.0.0
           RAET: 0.6.5
          smmap: 0.9.0
        timelib: 0.2.4
        Tornado: 4.4.2
            ZMQ: 4.1.5

System Versions:
           dist:   
        machine: x86_64
        release: 4.8.7-1-ARCH
         system: Linux
        version: Not Installed

salt-call pillar.items works, but getting one item doesn't work...

aboe76 avatar Nov 16 '16 18:11 aboe76

Ahh, ok will check that in a bit On Wed, Nov 16, 2016 at 12:01 PM Niels Abspoel [email protected] wrote:

I still have issues:

alt-call --versions-report Salt Version: Salt: 2016.11.0-389-g9fc2cee

Dependency Versions: cffi: 1.8.3 cherrypy: 8.1.2 dateutil: 2.6.0 gitdb: 0.6.4 gitpython: Not Installed ioflo: 1.6.5 Jinja2: 2.8 libgit2: 0.24.2 libnacl: 1.5.0 M2Crypto: 0.24.0 Mako: 1.0.6 msgpack-pure: Not Installed msgpack-python: 0.4.8 mysql-python: Not Installed pycparser: 2.17 pycrypto: 2.6.1 pygit2: 0.24.2 Python: 2.7.12 (default, Nov 7 2016, 11:55:55) python-gnupg: 0.3.9 PyYAML: 3.12 PyZMQ: 16.0.0 RAET: 0.6.5 smmap: 0.9.0 timelib: 0.2.4 Tornado: 4.4.2 ZMQ: 4.1.5

System Versions: dist: machine: x86_64 release: 4.8.7-1-ARCH system: Linux version: Not Installed

salt-call pillar.items works, but getting one item doesn't work...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/37713#issuecomment-261022280, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssoehv8VbEH3HUiVv8xmRHiuymO_kTks5q-0UPgaJpZM4KzGPF .

gtmanfred avatar Nov 16 '16 18:11 gtmanfred

Yup, I am getting the same behavior.

$ docker run -ti --rm gtmanfred/issues:37713 salt-call pillar.item users -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: 49702b21d07a
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[INFO    ] Could not determine init system from command line: (/usr/bin/python /usr/bin/salt-call pillar.item users -l debug)
[DEBUG   ] The `lspci` binary is not available on the system. GPU grains will not be available.
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded pillar.item
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
    users:

It also looks like it is broken in 2016.11.rc2

@bbinet have you tested pillar stack on carbon yet? And can you look at this, since it looks like you manage the pillarstack stuff?

Thanks Daniel

gtmanfred avatar Nov 16 '16 18:11 gtmanfred

[root@d0fcc2de2a73 /]# salt-call pillar.item users
local:
    ----------
    users:
[root@d0fcc2de2a73 /]# salt-call --versions-report
Salt Version:
           Salt: 2016.11.0rc2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Sep 15 2016, 22:37:39)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.1.6

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 4.4.24-boot2docker
         system: Linux
        version: CentOS Linux 7.2.1511 Core

gtmanfred avatar Nov 16 '16 18:11 gtmanfred

Actually, this looks like pillar.item doesn't work with external pillars on a masterless minion at all. It is not working with my states here https://github.com/gtmanfred/blog-sls/ using gitfs.

also, pillar.get doesn't work on the commandline either, but does appear to work in the state files

https://github.com/gtmanfred/blog-sls/blob/master/salt/gtmanfred/app.sls#L1-L4

gtmanfred avatar Nov 16 '16 19:11 gtmanfred

@aboe76 we will get it fixed for 2016.11.1

gtmanfred avatar Nov 16 '16 19:11 gtmanfred

@gtmanfred thanks for this!

aboe76 avatar Nov 16 '16 19:11 aboe76

To add, falling back from fileserver_backend to roots also gets affected even after removing gitfs remotes from masterless configuration. Downgrade from 21016.3.4 to 2015.8 doesn't help either. I've also refreshed pillar and whipped /var/cache/salt with no luck.

[root@localhost ~]# salt-call -l debug pillar.items
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/masterless.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/masterless.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: 10.0.2.15
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/masterless.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/masterless.conf
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded pillar.items
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
[root@localhost ~]# salt-call --versions-report
Salt Version:
           Salt: 2016.3.4

Dependency Versions:
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.21.0
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.21.4
         Python: 2.7.5 (default, Sep 15 2016, 22:37:39)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.36.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.2.1511 Core

[root@localhost ~]# cat /etc/salt/minion.d/masterless.conf
file_client: local
fileserver_backend:
  - roots
file_roots:
  base:
    - /srv/salt/states
pillar_roots:
  base:
    - /srv/salt/pillars
grains_dirs:
  - /srv/salt/grains
file_ignore_regex:
  - '/\.git($|/)'

layer3switch avatar Nov 22 '16 01:11 layer3switch

OK, as best as I can tell there are actually two separate issues here. This was initially broken in develop back in https://github.com/saltstack/salt/pull/32521 in what became the 2016.11 release branch. The Pillar compilation was being unnecessarily skipped, probably due to a misunderstanding of how Pillar works. When the file_client is set to local (as it is for masterless minions), a different Python class is used to compile the Pillar data, one that only looks at the minion config file and compiles the Pillar data locally, rather than sending a payload to the master requesting that the master compile Pillar data for it.

This issue is fixed in https://github.com/saltstack/salt/pull/37843, and the fix will be part of 2016.11.1. However, I took at look at the ~~master~~ develop branch and made the same fix there, but pillar.item still doesn't work as expected after applying that fix.

I'm currently investigating the issue on develop, I will update this issue when I've identified the issue and have a fix.

terminalmage avatar Nov 22 '16 19:11 terminalmage

Found and fixed the issue in develop as well, just opened PR https://github.com/saltstack/salt/pull/37844.

The 2016.11 and develop branches were the only ones affected, so the two PRs I opened here should resolve this.

terminalmage avatar Nov 22 '16 19:11 terminalmage

@terminalmage Thanks for this investigation when #37844 is merged in develop, I will compile a new salt-minion to test and verify.

aboe76 avatar Nov 22 '16 21:11 aboe76

confirmed the fix

aboe76 avatar Nov 28 '16 18:11 aboe76