[ARVADOS] updated: 2728f59746f7a57ed0283b899f9636cfef77d001
git at public.curoverse.com
git at public.curoverse.com
Wed Jan 29 14:04:40 EST 2014
Summary of changes:
.../20140117231056_normalize_collection_uuid.rb | 4 +-
...malize_collection_uuids_in_script_parameters.rb | 45 ++++++++++++++++++++
services/api/db/schema.rb | 2 +-
3 files changed, 48 insertions(+), 3 deletions(-)
create mode 100644 services/api/db/migrate/20140129184311_normalize_collection_uuids_in_script_parameters.rb
via 2728f59746f7a57ed0283b899f9636cfef77d001 (commit)
via 566bb36cbadbe0e4ceb1a30123033d9310a0f4d8 (commit)
from ca5197de7e459a48d72cda8e1f4de4c4201366fb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 2728f59746f7a57ed0283b899f9636cfef77d001
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Jan 29 11:04:12 2014 -0800
Remove +K at foo parts from collection uuids in jobs' script_parameters
and other job fields cached in PipelineInstances.
refs #1881
diff --git a/services/api/db/migrate/20140129184311_normalize_collection_uuids_in_script_parameters.rb b/services/api/db/migrate/20140129184311_normalize_collection_uuids_in_script_parameters.rb
new file mode 100644
index 0000000..b36241b
--- /dev/null
+++ b/services/api/db/migrate/20140129184311_normalize_collection_uuids_in_script_parameters.rb
@@ -0,0 +1,45 @@
+class NormalizeCollectionUuidsInScriptParameters < ActiveRecord::Migration
+ include CurrentApiClient
+ def up
+ act_as_system_user do
+ PipelineInstance.all.each do |pi|
+ pi.save! if fix_values_recursively(pi.components)
+ end
+ Job.all.each do |j|
+ changed = false
+ j.script_parameters.each do |p, v|
+ if v.is_a? String and v.match /\+K/
+ v.gsub! /\+K\@\w+/, ''
+ changed = true
+ end
+ end
+ j.save! if changed
+ end
+ end
+ end
+
+ def down
+ end
+
+ protected
+ def fix_values_recursively fixme
+ changed = false
+ if fixme.is_a? String
+ if fixme.match /\+K/
+ fixme.gsub! /\+K\@\w+/, ''
+ return true
+ else
+ return false
+ end
+ elsif fixme.is_a? Array
+ fixme.each do |v|
+ changed = fix_values_recursively(v) || changed
+ end
+ elsif fixme.is_a? Hash
+ fixme.each do |p, v|
+ changed = fix_values_recursively(v) || changed
+ end
+ end
+ changed
+ end
+end
diff --git a/services/api/db/schema.rb b/services/api/db/schema.rb
index 62d41f6..df6ea9b 100644
--- a/services/api/db/schema.rb
+++ b/services/api/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140124222114) do
+ActiveRecord::Schema.define(:version => 20140129184311) do
create_table "api_client_authorizations", :force => true do |t|
t.string "api_token", :null => false
commit 566bb36cbadbe0e4ceb1a30123033d9310a0f4d8
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Jan 29 10:41:19 2014 -0800
Fix regular expressions in database migration.
refs #1881
diff --git a/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb b/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb
index bec7ec7..b26c0a8 100644
--- a/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb
+++ b/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb
@@ -25,7 +25,7 @@ EOS
update_sql <<-EOS
UPDATE collections
SET uuid = regexp_replace(uuid,'\\+.*','') || '+' || length(manifest_text)
- WHERE uuid !~ '^[0-9a-f]{32,}\\+[0-9]+'
+ WHERE uuid !~ '^[0-9a-f]{32,}\\+[0-9]+$'
AND (regexp_replace(uuid,'\\+.*','') || '+' || length(manifest_text))
NOT IN (SELECT uuid FROM collections)
EOS
@@ -60,7 +60,7 @@ UPDATE links
AND (#{ht}_kind='arvados#collection' or #{ht}_uuid ~ '^[0-9a-f]{32,}')
AND #{ht}_uuid NOT IN (SELECT uuid FROM collections)
AND regexp_replace(#{ht}_uuid,'\\+.*','') = regexp_replace(c.uuid,'\\+.*','')
- AND c.uuid ~ '^[0-9a-f]{32,}\\+[0-9]+'
+ AND c.uuid ~ '^[0-9a-f]{32,}\\+[0-9]+$'
EOS
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list