From 22a64ac9e43c5637e8d167db43949aa1af011239 Mon Sep 17 00:00:00 2001 From: Jorge Schrauwen Date: Mon, 22 Feb 2016 13:13:19 +0000 Subject: [PATCH] fix virtual grain on SmartOS --- salt/grains/core.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/salt/grains/core.py b/salt/grains/core.py index 742eb1cc7b..efcecaad48 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -503,6 +503,14 @@ def _virtual(osdata): if osdata['kernel'] in skip_cmds: _cmds = () + # Quick backout for BrandZ (Solaris LX Branded zones, don't wast time on other commands) + uname = salt.utils.which('uname') + if osdata['kernel'] == 'Linux' and uname: + ret = __salt__['cmd.run_all']('{0} -v'.format(uname)) + if 'BrandZ' in ret['stdout']: + grains['virtual'] = 'zone' + return grains + failed_commands = set() for command in _cmds: args = []