Fix YAML error on minion start

This commit is contained in:
twangboy 2016-05-19 15:27:51 -06:00 committed by Pedro Algarvio
parent 57fbe717b9
commit 66e3624f2b
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
2 changed files with 9 additions and 12 deletions

View File

@ -9,6 +9,7 @@ from __future__ import absolute_import
# Import python libs # Import python libs
import logging import logging
from subprocess import check_output
# Import third party libs # Import third party libs
import yaml import yaml
@ -25,9 +26,7 @@ def ext_pillar(minion_id, # pylint: disable=W0613
''' '''
try: try:
command = command.replace('%s', minion_id) 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: except Exception:
log.critical( log.critical('YAML data from {0} failed to parse'.format(command))
'YAML data from {0} failed to parse'.format(command)
)
return {} return {}

View File

@ -990,14 +990,12 @@ class TestDaemon(object):
TMP_PRODENV_STATE_TREE TMP_PRODENV_STATE_TREE
] ]
} }
master_opts['ext_pillar'].append( if salt.utils.is_windows():
{'cmd_yaml': 'cat {0}'.format( master_opts['ext_pillar'].append(
os.path.join( {'cmd_yaml': 'type {0}'.format(os.path.join(FILES, 'ext.yaml'))})
FILES, else:
'ext.yaml' 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 # We need to copy the extension modules into the new master root_dir or
# it will be prefixed by it # it will be prefixed by it