diff --git a/salt/loader.py b/salt/loader.py index 610d10f1a9..f64b5c8c4d 100644 --- a/salt/loader.py +++ b/salt/loader.py @@ -1206,7 +1206,14 @@ class Loader(object): grains_data = {} funcs = self.gen_functions() for key, fun in funcs.items(): - if key[key.index('.') + 1:] == 'core': + if not key.startswith('core.'): + continue + ret = fun() + if not isinstance(ret, dict): + continue + grains_data.update(ret) + for key, fun in funcs.items(): + if key.startswith('core.'): continue try: ret = fun() @@ -1222,13 +1229,6 @@ class Loader(object): if not isinstance(ret, dict): continue grains_data.update(ret) - for key, fun in funcs.items(): - if key[key.index('.') + 1:] != 'core': - continue - ret = fun() - if not isinstance(ret, dict): - continue - grains_data.update(ret) # Write cache if enabled if self.opts.get('grains_cache', False): cumask = os.umask(077)