#780: fix rake task new_core#update_packages

This commit is contained in:
Vokhmin Alexey V 2013-01-10 18:48:26 +04:00
parent 4f9d63e4da
commit 26ec4cdeaf
1 changed files with 2 additions and 2 deletions

View File

@ -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!