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 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 {}

View File

@ -990,14 +990,12 @@ class TestDaemon(object):
TMP_PRODENV_STATE_TREE
]
}
if salt.utils.is_windows():
master_opts['ext_pillar'].append(
{'cmd_yaml': 'cat {0}'.format(
os.path.join(
FILES,
'ext.yaml'
)
)}
)
{'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