Skip to content

grains.get can't get minion's /etc/salt/grains value in multi-master set up #25040

Closed

Description

@yi9
[root@test-master~]# salt "*tst03*" grains.setval yiTest test
tst03.domain.com:
    ----------
    yiTest:
        test

[root@test-master salt]# cat /etc/salt/grains 
OSSize: 30G
RAMSize: 2G
yiTest: test

[root@test-master ~]# salt "*tst03*" grains.get yiTest       
tst03.domain.com:

Versions report:

[root@test-master ~]# salt "*tst03*" test.versions_report
               Salt: 2015.5.2
             Python: 2.6.6 (r266:84292, Jan 22 2014, 01:49:05)
             Jinja2: 2.2.1
           M2Crypto: 0.20.2
     msgpack-python: 0.4.6
       msgpack-pure: Not Installed
           pycrypto: 2.6.1
            libnacl: Not Installed
             PyYAML: 3.10
              ioflo: Not Installed
              PyZMQ: 14.5.0
               RAET: Not Installed
                ZMQ: 4.0.5
               Mako: Not Installed

As you can see, grains.get can't retrieve the grain's value which is already set up in minion successfully. In our minion configuration file, we define the multiple masters as below. We think the error was because grains master function can't return list, but only return one value.

minion configuration

master:
  - test-master.domain.com
  - test-master02.domain.com

grains core.py

return {'master': __opts__.get('master', '')}

Other than this, multi master works good with us so far as an initial test. Any suggestions?

Thanks,
Yi

Activity

  1. yi9 commented on Jun 29, 2015

    @yi9
    Author

    Sorry, the grains cat result should be below, was changing host name so it won't show our real host-name

    [root@tst03 salt]# cat /etc/salt/grains 
    OSSize: 30G
    RAMSize: 2G
    yiTest: test
    
  2. added
    bug
    severity-medium
    Core
    P4
    on Jul 1, 2015
  3. added this to the Approved milestone on Jul 1, 2015
  4. jfindlay commented on Jul 1, 2015

    @jfindlay
    Contributor

    @yi9, thanks for the report. As a workaround you can try salt "*tst03*" saltutil.reload_modules.

  5. yi9 commented on Jul 1, 2015

    @yi9
    Author

    there is no "reload+modules" function. We tried
    saltutil.refresh_modules, still doesn't work.

    Thanks,
    Yi

    On 7/1/15 4:27 PM, Justin Findlay wrote:

    @yi9 https://github.com/yi9, thanks for the report. As a workaround
    you can try |salt "tst03" saltutil.reload_modules|.

    —
    Reply to this email directly or view it on GitHub
    #25040 (comment).

  6. nmadhok commented on Jul 8, 2015

    @nmadhok
    Contributor

    @jfindlay Just wanted to point out that the grains get populated correctly after salt-minion is restarted on the minion. Grains retrieval works fine in that case on both masters.

  7. added
    P3
    and removed
    P4
    on Jul 8, 2015
  8. basepi commented on Aug 3, 2015

    @basepi
    Contributor

    @yi9 What happens if you run a salt '*' saltutil.sync_grains on each of the masters?

  9. basepi commented on Aug 3, 2015

    @basepi
    Contributor

    Interesting, refresh=True isn't the default? I think maybe it should be...

  10. FeatherKing commented on Aug 17, 2015

    @FeatherKing

    the docs show refresh=True as the default but this doesnt refresh the grain data for me. The only way I can see that grain data is to restart the minion. This becomes a problem where we store our program version as a grain and update the grain at the end of a setup. Now with multi master we have to restart the entire minion.

  11. mgresser commented on Jan 12, 2016

    @mgresser

    I'm also seeing this issue in 2015.8.3. I only see the grain info after minions are restarted.

  12. nmadhok commented on Mar 2, 2016

    @nmadhok
    Contributor

    This has been a High severity issue and a bug that exists in the Core reported in July 2015 and the issue still seems to exist in the latest stable version of Salt. Has anyone been working on this from the Salt team?

  13. basepi commented on Mar 2, 2016

    @basepi
    Contributor

    As far as I know it hasn't been on anyone's radar.

  14. DanyC97 commented on May 10, 2016

    @DanyC97

    @cachedout @jfindlay i don't know who is managing the backlog now that @basepi decided to try something else but i think this is issue should be looked at asap.

    I'm getting the same issue on latest v 2015.8.8.-2 where the new value is present in the minion's /etc/salt/grains file but but pulling the data from master using grains.get even after a salt-run cache.clear_all OR saltutil.sync_all OR restart minion service no change.

    I should mentioned i'm not in a multi-master setup (hence pls let me know if you feel i've hijacked the thread) ...if i did, sorry about it, let me know and i'll open a new issue

  15. cachedout commented on May 10, 2016

    @cachedout
    Contributor

    Holy cow!

    Wow, apologies. I haven't had this issue brought to my attention. Yes, this needs to be fixed ASAP. Thank you for pinging me, @DanyC97 . I'm on the case!

  16. added a commit that references this issue on May 10, 2016
    e23cd0e
  17. cachedout commented on May 10, 2016

    @cachedout
    Contributor

    OK, give #33142 a try. Fixes this in my testing.

    Apologies for letting this sit for so long!

  18. added
    fixed-pls-verify
    on May 10, 2016
  19. added a commit that references this issue on May 10, 2016
    033bef2
  20. DanyC97 commented on May 17, 2016

    @DanyC97

    thanks a bunch @cachedout !!

  21. linshaoyong commented on May 24, 2016

    @linshaoyong

    problem still exists, Multi-Master, 2015.8.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreGrainsMulti-MasterP3ZRELEASED - Boronbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions