mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Don't load the grains again when printing them via salt-call -g
The BaseCaller instance already has an SMinion stored in self.minion, and that SMinion instance compiles grains in its dunder init. This commit uses the SMinion's grains if it can find them, and only compiles fresh grains as a last resort. Even that seems to be erring on the side of caution, since the SMinion should always have grains. This prevents salt-call from compiling grains twice in a single run, resulting in a 40-50% speed reduction when running `salt-call -g`.
This commit is contained in:
parent
09b036c26e
commit
caa62c051f
1 changed files with 1 additions and 1 deletions
|
@ -120,7 +120,7 @@ class BaseCaller(object):
|
|||
'''
|
||||
Print out the grains
|
||||
'''
|
||||
grains = salt.loader.grains(self.opts)
|
||||
grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
|
||||
salt.output.display_output({'local': grains}, 'grains', self.opts)
|
||||
|
||||
def run(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue