From 6fe86b988b7f34eac091296aa528b4d34e11336f Mon Sep 17 00:00:00 2001 From: "Tejeda, Engelbert" Date: Fri, 4 Oct 2019 16:31:45 -0400 Subject: [PATCH] Fixed bug in sync logic whereby sync action was causing local dir to be nested in remote --- ansible_taskrunner/libs/providers/ansible.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ansible_taskrunner/libs/providers/ansible.py b/ansible_taskrunner/libs/providers/ansible.py index 0f8e22c..6ada25c 100644 --- a/ansible_taskrunner/libs/providers/ansible.py +++ b/ansible_taskrunner/libs/providers/ansible.py @@ -119,7 +119,7 @@ def invoke_bastion_mode(self, bastion_settings, invocation): mkdir_result = remote_sub_process.call('/', cmd) if mkdir_result: logger.info("Performing initial sync to %s ..." % remote_dir) - sftp_sync.to_remote(local_dir, remote_dir) + sftp_sync.to_remote('.', remote_dir) rem_exists = True else: logger.error('Unable to create remote path!') @@ -134,7 +134,8 @@ def invoke_bastion_mode(self, bastion_settings, invocation): # that have changed within the last 5 minutes _dir = os.getcwd() local_changed = (fle for rt, _, f in os.walk(_dir) for fle in f if time.time() - os.stat(os.path.join(rt, fle)).st_mtime < 300) - local_changed = [f for f in os.listdir('.') if os.path.isfile(f)] + exclusions = ['sftp-config.json'] + local_changed = [f for f in os.listdir('.') if os.path.isfile(f) and f not in exclusions] logger.info('Checking for remotely changed files ...') no_clobber = settings.get('at_no_clobber') if rem_is_git: