juju-solutions / cloud-weather-report

Apache License 2.0
2 stars 7 forks source link

OSError: No such file or directory #85

Closed seman closed 7 years ago

seman commented 7 years ago

cwr tries to remove a directory/file that doesn't exist or already removed:

https://pastebin.canonical.com/171062/

2016-11-17 23:28:39 INFO Error in atexit._run_exitfuncs:
2016-11-17 23:28:39 INFO Traceback (most recent call last):
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
2016-11-17 23:28:39 INFO     func(*targs, **kargs)
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/shutil.py", line 239, in rmtree
2016-11-17 23:28:39 INFO     onerror(os.listdir, path, sys.exc_info())
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/shutil.py", line 237, in rmtree
2016-11-17 23:28:39 INFO     names = os.listdir(path)
2016-11-17 23:28:39 INFO OSError: [Errno 2] No such file or directory: '/tmp/cwr-tmp-47s5S3/tmpC1FCrX'
2016-11-17 23:28:39 INFO Error in atexit._run_exitfuncs:
2016-11-17 23:28:39 INFO Traceback (most recent call last):
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
2016-11-17 23:28:39 INFO     func(*targs, **kargs)
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/shutil.py", line 239, in rmtree
2016-11-17 23:28:39 INFO     onerror(os.listdir, path, sys.exc_info())
2016-11-17 23:28:39 INFO   File "/usr/lib/python2.7/shutil.py", line 237, in rmtree
2016-11-17 23:28:39 INFO     names = os.listdir(path)
2016-11-17 23:28:39 INFO OSError: [Errno 2] No such file or directory: '/tmp/cwr-tmp-47s5S3/tmpnV0Pnz'
...
johnsca commented 7 years ago

Looks like bundletester/tester.py#L125 is competing with cloudweatherreport/run.py#L256. Either BT should be changed to use a context manager or try / finally, or CWR should be changed to use atexit.

kwmonroe commented 7 years ago

I talked about this one with @johnsca with a potential fix in cwr that uses atexit in a way that won't cause bundletester's atexits to fail:

http://paste.ubuntu.com/23590240/

But this breaks 4-5 unit tests, which would be annoying to fix. Cory thinks changing bundletester to a try/finally might be the easier approach, and is looking at it.

johnsca commented 7 years ago

I have a fix for this ready in bundletester and am working to get it released as soon as I can.