From 7a89d7c32f42ff6b40ca17d0bfd9193912793cc1 Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 19 May 2016 13:58:20 -0600 Subject: [PATCH 1/5] Fix vistara error on master initialization --- salt/runners/vistara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/runners/vistara.py b/salt/runners/vistara.py index 220e284d3843..22e2ec082f21 100644 --- a/salt/runners/vistara.py +++ b/salt/runners/vistara.py @@ -74,7 +74,7 @@ def _get_vistara_configuration(): "Exception enountered: {0}.format(exc)" ) return False - log.error( + log.warning( "vistara config has not been specificed in the Salt master config. " "See documentation for this runner." ) From e65a355da52b30824fda2e1e591d65ea57319dfb Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 19 May 2016 15:27:51 -0600 Subject: [PATCH 2/5] Fix YAML error on minion start --- salt/pillar/cmd_yaml.py | 7 +++---- tests/integration/__init__.py | 14 ++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/salt/pillar/cmd_yaml.py b/salt/pillar/cmd_yaml.py index 9d4c41e118a3..34b4af87c62a 100644 --- a/salt/pillar/cmd_yaml.py +++ b/salt/pillar/cmd_yaml.py @@ -9,6 +9,7 @@ # Import python libs import logging +from subprocess import check_output # Import third party libs import yaml @@ -25,9 +26,7 @@ def ext_pillar(minion_id, # pylint: disable=W0613 ''' try: command = command.replace('%s', minion_id) - return yaml.safe_load(__salt__['cmd.run']('{0}'.format(command))) + return yaml.safe_load(check_output(r'{0}'.format(command), shell=True)) except Exception: - log.critical( - 'YAML data from {0} failed to parse'.format(command) - ) + log.critical('YAML data from {0} failed to parse'.format(command)) return {} diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index b6235173ff9d..268b01e8e11c 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -980,14 +980,12 @@ def transplant_configs(cls, transport='zeromq'): TMP_PRODENV_STATE_TREE ] } - master_opts['ext_pillar'].append( - {'cmd_yaml': 'cat {0}'.format( - os.path.join( - FILES, - 'ext.yaml' - ) - )} - ) + if salt.utils.is_windows(): + master_opts['ext_pillar'].append( + {'cmd_yaml': 'type {0}'.format(os.path.join(FILES, 'ext.yaml'))}) + else: + master_opts['ext_pillar'].append( + {'cmd_yaml': 'cat {0}'.format(os.path.join(FILES, 'ext.yaml'))}) # We need to copy the extension modules into the new master root_dir or # it will be prefixed by it From 00c9bf6b520bdd432de8ab8e42ffd3830dadb1e3 Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 19 May 2016 16:10:46 -0600 Subject: [PATCH 3/5] Revert the vistara runner to throw an error --- salt/runners/vistara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/runners/vistara.py b/salt/runners/vistara.py index 22e2ec082f21..220e284d3843 100644 --- a/salt/runners/vistara.py +++ b/salt/runners/vistara.py @@ -74,7 +74,7 @@ def _get_vistara_configuration(): "Exception enountered: {0}.format(exc)" ) return False - log.warning( + log.error( "vistara config has not been specificed in the Salt master config. " "See documentation for this runner." ) From d268b7f269bd31b6cb0ca2e47442dc98fc28c4b6 Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 19 May 2016 16:20:42 -0600 Subject: [PATCH 4/5] Fix cmd_yaml to work on windows --- salt/pillar/cmd_yaml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/pillar/cmd_yaml.py b/salt/pillar/cmd_yaml.py index 34b4af87c62a..b63813c1969b 100644 --- a/salt/pillar/cmd_yaml.py +++ b/salt/pillar/cmd_yaml.py @@ -9,7 +9,6 @@ # Import python libs import logging -from subprocess import check_output # Import third party libs import yaml @@ -26,7 +25,8 @@ def ext_pillar(minion_id, # pylint: disable=W0613 ''' try: command = command.replace('%s', minion_id) - return yaml.safe_load(check_output(r'{0}'.format(command), shell=True)) + return yaml.safe_load( + __salt__['cmd.run_stdout'](r'{0}'.format(command), python_shell=True)) except Exception: log.critical('YAML data from {0} failed to parse'.format(command)) return {} From 1c22cf44284613546b3689832bf771c67b073dc2 Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 19 May 2016 16:29:43 -0600 Subject: [PATCH 5/5] Remove r --- salt/pillar/cmd_yaml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/pillar/cmd_yaml.py b/salt/pillar/cmd_yaml.py index b63813c1969b..16f92b3de55d 100644 --- a/salt/pillar/cmd_yaml.py +++ b/salt/pillar/cmd_yaml.py @@ -26,7 +26,7 @@ def ext_pillar(minion_id, # pylint: disable=W0613 try: command = command.replace('%s', minion_id) return yaml.safe_load( - __salt__['cmd.run_stdout'](r'{0}'.format(command), python_shell=True)) + __salt__['cmd.run_stdout']('{0}'.format(command), python_shell=True)) except Exception: log.critical('YAML data from {0} failed to parse'.format(command)) return {}