From 26ec4cdeaf00caa42bcdccb7deb59dd2550f18a2 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 10 Jan 2013 18:48:26 +0400 Subject: [PATCH] #780: fix rake task new_core#update_packages --- lib/tasks/new_core.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/new_core.rake b/lib/tasks/new_core.rake index 5628b0067..c486815cf 100644 --- a/lib/tasks/new_core.rake +++ b/lib/tasks/new_core.rake @@ -72,7 +72,7 @@ namespace :new_core do bl = bls.first puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}" - sha1 = bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }['sha1'] + sha1 = (bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ } || {})['sha1'] next unless sha1 dir = Dir.mktmpdir('update-packages-', "#{APP_CONFIG['root_path']}") begin @@ -99,7 +99,7 @@ namespace :new_core do next unless package package.sha1 = Digest::SHA1.file(rpm_file).hexdigest - if %x[ curl #{APP_CONFIG['file_store_url']}/api/v1/file_stores.json?hash=#{sha1} ] == '[]' + if %x[ curl #{APP_CONFIG['file_store_url']}/api/v1/file_stores.json?hash=#{package.sha1} ] == '[]' system "curl --user #{token}: -POST -F 'file_store[file]=@#{rpm_file}' #{APP_CONFIG['file_store_url']}/api/v1/upload" end package.save!