refine heredoces to handle issues in sudo commands

This commit is contained in:
Thomas S Hatch 2013-09-25 21:50:30 -06:00
parent ca31aea76e
commit 29dbe592fe

View File

@ -42,15 +42,15 @@ HEREDOC = (' << "EOF"\n'
' if [[ $(cat /tmp/.salt/version) != {0} ]]\n'
' then\n'
' rm -rf /tmp/.salt\n'
' mkdir -p /tmp/.salt\n'
' install -m 777 -d /tmp/.salt\n'
' echo "{1}"\n'
' echo "deploy"\n'
' exit 1\n'
' fi\n'
' SALT=/tmp/.salt/salt-call\n'
'else\n'
' mkdir -p /tmp/.salt\n'
' echo "{1}"\n'
' install -m 777 -d /tmp/.salt\n'
' echo "deploy"\n'
' exit 1\n'
'fi\n'
@ -375,7 +375,7 @@ class Single(object):
thin,
'/tmp/.salt/salt-thin.tgz')
self.shell.exec_cmd(
'tar xvf /tmp/.salt/salt-thin.tgz -C /tmp/.salt && rm /tmp/.salt/salt-thin.tgz'
'tar xvf /tmp/.salt/salt-thin.tgz -C /tmp/.salt'
)
return True
@ -482,6 +482,8 @@ class Single(object):
if stdout.startswith('deploy'):
self.deploy()
stdout, stderr = self.shell.exec_cmd(cmd)
if RSTR in stdout:
stdout = stdout.split(RSTR)[1].strip()
return stdout, stderr
def sls_seed(self, mods, env='base', test=None, exclude=None, **kwargs):