Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_scripts/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e

echo "Building package"
rm -rf dist/
export BOTO_CONFIG=/dev/null
python setup.py sdist bdist_wheel
ls -l dist/
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
simpledi>=0.2
awscli==1.16.97
awscli==1.16.206
ansible==2.7.10
s3transfer==0.1.13
boto3==1.9.87
boto3==1.9.196
boto==2.49.0
botocore==1.12.87
botocore==1.12.196
PyYAML==3.13
azure-common==1.1.20
azure==4.0.0
Expand Down
10 changes: 5 additions & 5 deletions src/ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
class Executor(object):
""" All cli commands usually return a dict(command=...) that will be executed by this handler"""

def __call__(self, result, pass_trough=True):
def __call__(self, result, pass_trough=True, cwd=None):
try:
return self._execute(result, pass_trough)
return self._execute(result, pass_trough, cwd)
except Exception as ex:
display(ex.message, stderr=True, color='red')
display('------- TRACEBACK ----------', stderr=True, color='dark gray')
import traceback
traceback.print_exc()
display('------ END TRACEBACK -------', stderr=True, color='dark gray')

def _execute(self, result, pass_trough=True):
def _execute(self, result, pass_trough=True, cwd=None):
if not result or not isinstance(result, dict):
return

if 'command' in result:
shell_command = result['command']
display("%s" % self.shadow_credentials(shell_command), stderr=True, color='yellow')
if pass_trough:
exit_code = call(shell_command, shell=True)
exit_code = call(shell_command, shell=True, cwd=cwd)
else:
p = Popen(shell_command, shell=True, stdout=PIPE, stderr=PIPE)
p = Popen(shell_command, shell=True, stdout=PIPE, stderr=PIPE, cwd=cwd)
output, errors = p.communicate()
display(output)
if errors:
Expand Down