Merge pull request #25875 from rallytime/bp-25862

Back-port #25862 to 2015.5
This commit is contained in:
Thomas S Hatch 2015-07-30 11:34:02 -06:00
commit 6ce0b3e5b8
3 changed files with 12 additions and 2 deletions

View file

@ -1048,6 +1048,11 @@ ARGS = {9}\n'''.format(self.minion_config,
'checksum mismatched',
'The salt thin transfer was corrupted'
),
(
(salt.defaults.exitcodes.EX_SCP_NOT_FOUND,),
'scp not found',
'No scp binary. openssh-clients package required'
),
(
(salt.defaults.exitcodes.EX_CANTCREAT,),
'salt path .* exists but is not a directory',

View file

@ -16,6 +16,7 @@ import shutil
import sys
import os
import stat
import subprocess
THIN_ARCHIVE = 'salt-thin.tgz'
EXT_ARCHIVE = 'salt-ext_mods.tgz'
@ -24,6 +25,7 @@ EXT_ARCHIVE = 'salt-ext_mods.tgz'
EX_THIN_DEPLOY = 11
EX_THIN_CHECKSUM = 12
EX_MOD_DEPLOY = 13
EX_SCP_NOT_FOUND = 14
class OBJ(object):
@ -132,6 +134,10 @@ def main(argv): # pylint: disable=W0613
unpack_thin(thin_path)
# Salt thin now is available to use
else:
scpstat = subprocess.Popen(['/bin/bash', '-c', 'command -v scp']).wait()
if not scpstat == 0:
sys.exit(EX_SCP_NOT_FOUND)
if not os.path.exists(OPTIONS.saltdir):
need_deployment()
@ -206,14 +212,12 @@ def main(argv): # pylint: disable=W0613
sys.stderr.write(OPTIONS.delimiter + '\n')
sys.stderr.flush()
if OPTIONS.tty:
import subprocess
stdout, _ = subprocess.Popen(salt_argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
sys.stdout.write(stdout)
sys.stdout.flush()
if OPTIONS.wipe:
shutil.rmtree(OPTIONS.saltdir)
elif OPTIONS.wipe:
import subprocess
subprocess.call(salt_argv)
shutil.rmtree(OPTIONS.saltdir)
else:

View file

@ -14,6 +14,7 @@ EX_THIN_PYTHON_OLD = 10
EX_THIN_DEPLOY = 11
EX_THIN_CHECKSUM = 12
EX_MOD_DEPLOY = 13
EX_SCP_NOT_FOUND = 14
# The os.EX_* exit codes are Unix only so in the interest of cross-platform
# compatiblility define them explicitly here.