I've done the change myself, please review: https://review.openstack.org/327539
I decided to catch the exception instead of always deleting the dst file first to keep it being an atomic operation on Unix. -- Sebastian Schuberth On Thu, Jun 9, 2016 at 7:01 AM, Sebastian Schuberth <[email protected]> wrote: > Hi Darragh, > > are you going to make that change in Gerrit? > > -- > Sebastian Schuberth > > > On Thu, Jun 9, 2016 at 12:52 AM, Darragh Bailey <[email protected]> > wrote: > >> Doh! It's called not using windows enough. >> >> The os.rename() it appears throws an error on windows if the target file >> exists. >> >> We need to catch that and remove the file, then retry, or remove the old >> file first. >> >> The fun of cross platform. >> >> Sorry about that. >> >> Darragh Bailey >> "Nothing is foolproof to a sufficiently talented fool" - unknown >> >> On 8 Jun 2016 21:15, "Sebastian Schuberth" <[email protected]> wrote: >>> >>> Hi, >>> >>> since upgrading to JJB 1.6.0 from 1.5.0 today I consistently get >>> "Cannot create a file when that file already exists" errors on update >>> / delete operations on Windows. The stack trace looks like >>> >>> $ jenkins-jobs delete github-checker.yaml >>> INFO:jenkins_jobs.builder:Removing jenkins job(s): github-checker.yaml >>> Traceback (most recent call last): >>> File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main >>> "__main__", fname, loader, pkg_name) >>> File "c:\python27\lib\runpy.py", line 72, in _run_code >>> exec code in run_globals >>> File "C:\Python\Scripts\jenkins-jobs.exe\__main__.py", line 9, in >>> <module> >>> File "c:\python27\lib\site-packages\jenkins_jobs\cmd.py", line 191, in >>> main >>> execute(options, config) >>> File "c:\python27\lib\site-packages\jenkins_jobs\cmd.py", line 357, in >>> execute >>> builder.delete_job(job, options.path) >>> File "c:\python27\lib\site-packages\jenkins_jobs\builder.py", line >>> 322, in delete_job >>> self.cache.save() >>> File "c:\python27\lib\site-packages\jenkins_jobs\builder.py", line >>> 113, in save >>> self._os.rename(tfile.name, self.cachefilename) >>> WindowsError: [Error 183] Cannot create a file when that file already >>> exists >>> ERROR:jenkins_jobs.builder:Failed to write to cache file >>> >>> 'C:\Users\name\.cache\jenkins_jobs\cache-host-jobs-https___hostname_com_.yml' >>> on exit: [Error 183] Cannot create a file when that file already >>> exists >>> >>> Is anyone else seeing this? >>> >>> -- >>> Sebastian Schuberth >>> >>> _______________________________________________ >>> OpenStack-Infra mailing list >>> [email protected] >>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra _______________________________________________ OpenStack-Infra mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra
