Don't copy the __pycache__ folder
On startup the executor copies the ansible modules into its state dir. In case of restarting the executor it could happen that it tries to copy the __pycache__ folder which fails with [1]. This can be fixed by not copying it as it's not needed. [1] Example error trace: Traceback (most recent call last): File "/usr/bin/zuul-executor", line 10, in <module> sys.exit(main()) File "/opt/zuul/lib/python3.5/site-packages/zuul/cmd/executor.py", line 170, in main server.main(False) File "/opt/zuul/lib/python3.5/site-packages/zuul/cmd/executor.py", line 136, in main keep_jobdir=self.args.keep_jobdir) File "/opt/zuul/lib/python3.5/site-packages/zuul/executor/server.py", line 312, in __init__ _copy_ansible_files(zuul.ansible.library, self.library_dir) File "/opt/zuul/lib/python3.5/site-packages/zuul/executor/server.py", line 240, in _copy_ansible_files shutil.copytree(full_path, os.path.join(target_dir, fn)) File "/usr/lib/python3.5/shutil.py", line 309, in copytree os.makedirs(dst) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/mnt/zuul/state/ansible/library/__pycache__' Change-Id: I1ed334d67ee59e2f9157eca34c9376f7af9ea457
This commit is contained in:
parent
0e7a1c8326
commit
f3a59e63f6
|
@ -235,6 +235,8 @@ class DeduplicateQueue(object):
|
|||
def _copy_ansible_files(python_module, target_dir):
|
||||
library_path = os.path.dirname(os.path.abspath(python_module.__file__))
|
||||
for fn in os.listdir(library_path):
|
||||
if fn == "__pycache__":
|
||||
continue
|
||||
full_path = os.path.join(library_path, fn)
|
||||
if os.path.isdir(full_path):
|
||||
shutil.copytree(full_path, os.path.join(target_dir, fn))
|
||||
|
|
Loading…
Reference in New Issue