From e6cf2dbb207811265d8adfafb297558b43c4cc82 Mon Sep 17 00:00:00 2001 From: Constantin Muraru Date: Fri, 26 Jul 2019 00:06:48 +0300 Subject: [PATCH 1/2] Make it possible to specify the current dir when using the Executor Signed-off-by: cmuraru --- src/ops/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ops/__init__.py b/src/ops/__init__.py index f4259301..a6f3d0dd 100644 --- a/src/ops/__init__.py +++ b/src/ops/__init__.py @@ -16,9 +16,9 @@ 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') @@ -26,7 +26,7 @@ def __call__(self, result, pass_trough=True): 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 @@ -34,9 +34,9 @@ def _execute(self, result, pass_trough=True): 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: From 876432904f13c85bb864cbb36ace747c0d881d39 Mon Sep 17 00:00:00 2001 From: cmuraru Date: Fri, 26 Jul 2019 15:51:43 +0300 Subject: [PATCH 2/2] Fix build Signed-off-by: cmuraru --- build_scripts/build_package.sh | 1 + requirements.txt | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_scripts/build_package.sh b/build_scripts/build_package.sh index 0f4e34a3..ca702ca5 100644 --- a/build_scripts/build_package.sh +++ b/build_scripts/build_package.sh @@ -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/ diff --git a/requirements.txt b/requirements.txt index 60ccedf1..812d3c5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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