On Tue, 2010-10-26 at 17:04 +0200, [email protected] wrote: > From: Jan Provaznik <[email protected]> > > --- > .../util/repository_manager/comps_repository.rb | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/app/util/repository_manager/comps_repository.rb > b/src/app/util/repository_manager/comps_repository.rb > index 86c4da7..6a90f14 100644 > --- a/src/app/util/repository_manager/comps_repository.rb > +++ b/src/app/util/repository_manager/comps_repository.rb > @@ -64,8 +64,9 @@ class CompsRepository < AbstractRepository > end > > Dir.mkdir(@cache_dir) unless File.directory?(@cache_dir) > - Marshal.dump({:groups => grps, > - :categories => categories}, File.open(@cache_file, 'w')) > + File.open(@cache_file, 'w') do |f| > + Marshal.dump({:groups => grps, :categories => categories}, f) > + end > end > > private > @@ -73,7 +74,7 @@ class CompsRepository < AbstractRepository > def load_data > unless @load_data > begin > - @load_data = Marshal.load(File.open(@cache_file, 'r')) > + File.open(@cache_file, 'r') { |f| @load_data = Marshal.load(f) } > rescue Errno::ENOENT > raise "failed to read cached packages info, run 'rake > dc:prepare_repos'" > end
As this issue is hard to reproduce, I cannot say for certain that this fixes it, but it does continue to work correctly in general. I ran it a bunch of times, and it properly rewrites the data file. If I disconnect from network, I get the expected error from the http call. So, this _might_ fix the problem, but even if not, does not appear to break anything. ACK, unless anyone else has a major issue with it. -j _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
