Skip to content

Commit

Permalink
Add hooks to geenrate the thin sum and pass to the shim
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch45 authored and basepi committed Oct 14, 2013
1 parent 992fe1c commit 207213a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
fi
if [ -f /tmp/.salt/salt-thin.tgz ]
then
[ $({{1}} /etc/fstab | cut -f1 -d' ') == {{2}} ] && {{0}} tar xzvf /tmp/.salt/salt-thin.tgz -C /tmp/.salt
[ $({{2}}sum /tmp/.salt/salt-thin.tgz | cut -f1 -d' ') == {{3}} ] && {{0}} tar xzvf /tmp/.salt/salt-thin.tgz -C /tmp/.salt
else
install -m 1700 -d /tmp/.salt
echo "{1}"
Expand Down Expand Up @@ -536,7 +536,14 @@ def cmd(self):
self.sls_seed, self.arg)
self.sls_seed(*args, **kwargs)
sudo = 'sudo' if self.target['sudo'] else ''
cmd = SSH_SHIM.format(sudo, self.arg_str)
thin_sum = salt.utils.thin.thin_sum(
self.opts['cachedir'],
self.opts['hash_type'])
cmd = SSH_SHIM.format(
sudo,
self.arg_str,
self.opts['hash_type'],
thin_sum)
for stdout, stderr in self.shell.exec_nb_cmd(cmd):
yield stdout, stderr

Expand All @@ -549,7 +556,14 @@ def cmd_block(self, is_retry=False):
# 3. deploy salt-thin
# 4. execute command
sudo = 'sudo' if self.target['sudo'] else ''
cmd = SSH_SHIM.format(sudo, self.arg_str)
thin_sum = salt.utils.thin.thin_sum(
self.opts['cachedir'],
self.opts['hash_type'])
cmd = SSH_SHIM.format(
sudo,
self.arg_str,
self.opts['hash_type'],
thin_sum)
log.debug("Performing shimmed command as follows:\n{0}".format(cmd))
stdout, stderr = self.shell.exec_cmd(cmd)

Expand Down

0 comments on commit 207213a

Please sign in to comment.