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

2018.3.2 cache.grains not returning any grains. #48694

Closed
whytewolf opened this issue Jul 20, 2018 · 11 comments

Comments

Projects
None yet
4 participants
@whytewolf
Copy link
Contributor

commented Jul 20, 2018

Description of Issue/Question

salt-run cache.grains is not returning any data about the cached grains on a master.
This only appears to be 2018.3.2

Setup

Install 2018.3.2 on a system with a master.
refresh the grains or give time for the cache to be populated.
Run salt-run cache.grains or salt-run cache.grains tgt=minion

Steps to Reproduce Issue

salt-run cache.grains -l debug
[root@master ~]# salt-run cache.grains -l debug
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG   ] Missing configuration file: /root/.saltrc
[DEBUG   ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] LazyLoaded cache.grains
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event: tag = salt/run/20180720182040682530/new; data = {u'fun': u'runner.cache.grains', u'fun_args': [], u'jid': u'20180720182040682530', u'user': u'root', u'_stamp': '2018-07-20T18:20:41.167225'}
[DEBUG   ] New instance of MasterPillarUtil created.
[DEBUG   ] Init settings: tgt: 'None', tgt_type: 'glob', saltenv: 'None', use_cached_grains: True, use_cached_pillar: True, grains_fallback: False, pillar_fallback: True
[DEBUG   ] No minions matched for tgt="None" and tgt_type="glob"
[DEBUG   ] LazyLoaded local_cache.prep_jid
[DEBUG   ] Adding minions for job 20180720182040682530: [u'master_master']
[DEBUG   ] Sending event: tag = salt/run/20180720182040682530/ret; data = {u'fun_args': [], u'jid': u'20180720182040682530', u'return': {}, u'success': True, u'_stamp': '2018-07-20T18:20:41.170635', u'user': u'root', u'fun': u'runner.cache.grains'}
[DEBUG   ] LazyLoaded nested.output
[INFO    ] Runner completed: 20180720182040682530
[DEBUG   ] Runner return: {}
salt-run cache.grains tgt=master -l debug
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG   ] Missing configuration file: /root/.saltrc
[DEBUG   ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] LazyLoaded cache.grains
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event: tag = salt/run/20180720182313545490/new; data = {u'fun': u'runner.cache.grains', u'fun_args': [{u'tgt': u'master'}], u'jid': u'20180720182313545490', u'user': u'root', u'_stamp': '2018-07-20T18:23:14.043191'}
[DEBUG   ] New instance of MasterPillarUtil created.
[DEBUG   ] Init settings: tgt: 'master', tgt_type: 'glob', saltenv: 'None', use_cached_grains: True, use_cached_pillar: True, grains_fallback: False, pillar_fallback: True
[DEBUG   ] No minions matched for tgt="master" and tgt_type="glob"
[DEBUG   ] LazyLoaded local_cache.prep_jid
[DEBUG   ] Adding minions for job 20180720182313545490: [u'master_master']
[DEBUG   ] Sending event: tag = salt/run/20180720182313545490/ret; data = {u'fun_args': [{u'tgt': u'master'}], u'jid': u'20180720182313545490', u'return': {}, u'success': True, u'_stamp': '2018-07-20T18:23:14.048834', u'user': u'root', u'fun': u'runner.cache.grains'}
[DEBUG   ] LazyLoaded nested.output
[INFO    ] Runner completed: 20180720182313545490
[DEBUG   ] Runner return: {}
master:
    ----------
    SSDs:
    biosreleasedate:
        12/01/2006
    biosversion:
        VirtualBox      
  ...
    uid:
        0
    username:
        root
    uuid:
        fe6cab86-a8f1-40c6-b9e7-cb92d26d2f2f
    virtual:
        VirtualBox
    zfs_feature_flags:
        False
    zfs_support:
        False
    zmqversion:
        4.1.4

Versions Report

salt --versions
Salt Version:
           Salt: 2018.3.2

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.26.3
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.4
         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)
   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.4.1708 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-693.11.6.el7.x86_64
         system: Linux
        version: CentOS Linux 7.4.1708 Core

@whytewolf whytewolf added the ZD label Jul 20, 2018

@whytewolf

This comment has been minimized.

Copy link
Contributor Author

commented Jul 20, 2018

ZD-2711

@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2018

looks like i can replicate this adn i bisected it to 4718d31

@Ch3LL Ch3LL added this to the Approved milestone Jul 23, 2018

@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2018

also to note i noticed it was working in 2018.3.0 and not >=2018.3.1

@V3XATI0N

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2018

for what it's worth, I am still able to retrieve the cache via salt-api, just not via CLI.

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Aug 2, 2018

This is fixed on the HEAD of the branch with #48765

@whytewolf @Ch3LL @V3XATI0N ^

@whytewolf

This comment has been minimized.

Copy link
Contributor Author

commented Aug 2, 2018

@rallytime The fix works great for target based grain searches. But non-target based searches still come up blank.

Before broken:

command reaction
salt-run cache.grains tgt='minion' minions grains
salt-run cache.grains tgt='*' all grains for all minions
salt-run cache.grains all grains for all minions

Broken:

command reaction
salt-run cache.grains tgt='minion' blank
salt-run cache.grains tgt='*' blank
salt-run cache.grains blank

After fix in #48765:

command reaction
salt-run cache.grains tgt='minion' minions grains
salt-run cache.grains tgt='*' all grains for all minions
salt-run cache.grains blank

Could always go with a documentation change after the fix goes live. As the functionality is there. just need to change how you access it.

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2018

@whytewolf Ah, yes, we did see this in our testing.

@cachedout What do you think about just changing the docs for this?

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2018

Actually, we should fix that because it's technically a regression. But the tgt can be used for now.

@whytewolf

This comment has been minimized.

Copy link
Contributor Author

commented Aug 3, 2018

so after looking a bit more.

The targetless grains appears to have been broken in 2017.7.5 as well. but was working in 2017.7.3.

And 2017.7.5 the targeted cache.grains still works.

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2018

@whytewolf Ah! Good info. Thank you - that will help in tracking this down.

rallytime added a commit to rallytime/salt that referenced this issue Aug 24, 2018

Update documentation for saltstack#48694 and add deprecation warning
There was a behavior change when using `salt-run cache.grains` beginning
with the 2017.7.5 release.

The behavior change happened in PR saltstack#45588, which was back-ported to the
2017.7 branch in PR saltstack#45751. This was done in order to fix the bug reported
in saltstack#45489.

In order to be helpful to users, a deprecation warning was added. If ``tgt``
is not passed, no grains will be listed. Instead of suddenly requiring a ``tgt``
argument in a dot release, let's keep this optional arg around until Sodium.

When Salt Sodium is released, we can remove the warning and change ``tgt`` to be
a mandatory argument.

Fixes the last parts of saltstack#48694.
@rallytime

This comment has been minimized.

Copy link
Contributor

commented Aug 24, 2018

@whytewolf OK, after some more research here, it is intentional that using salt-run grains.cache no longer returns cached grains. The tgt option is necessary, beginning with the 2017.7.5 release.

The behavior change happened in PR #45588, which was back-ported to the 2017.7 branch in PR #45751. This was done in order to fix the bug reported in #45489.

In order to be helpful to users, I added a deprecation warning. If tgt is not passed, no grains will be listed. Instead of suddenly requiring a tgt argument in a dot release, let's keep this optional arg around until Sodium. This will help inform users of the behavior change in the mean time. I also updated the doc example.

I think we can call this one complete now, yes?

gtmanfred added a commit that referenced this issue Aug 25, 2018

Merge pull request #49320 from rallytime/fix-48694
Update documentation for #48694 and add deprecation warning

@rallytime rallytime closed this Sep 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.