Actually caused by the instance.condor_job_id field being too
short. This expands this field (so long as condor can handle
a job id of this length)
---
 src/app/models/instance.rb                         |    1 +
 ...20101203162334_expand_instance_condor_job_id.rb |   26 ++++++++++++++++++++
 src/spec/models/instance_spec.rb                   |    7 +++++
 3 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 
src/db/migrate/20101203162334_expand_instance_condor_job_id.rb

diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 22069e2..e3d65bc 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -47,6 +47,7 @@ class Instance < ActiveRecord::Base
   validates_presence_of :name
   validates_uniqueness_of :name, :scope => :pool_id
   validates_length_of :name, :maximum => 1024
+  validates_length_of :condor_job_id, :maximum => 2048, :unless => Proc.new { 
|i| i.condor_job_id.nil? }
 
   STATE_NEW            = "new"
   STATE_PENDING        = "pending"
diff --git a/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb 
b/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb
new file mode 100644
index 0000000..7ea1002
--- /dev/null
+++ b/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb
@@ -0,0 +1,26 @@
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+class ExpandInstanceCondorJobId < ActiveRecord::Migration
+  def self.up
+    change_column :instances, :condor_job_id, :string, :limit => 2048
+  end
+
+  def self.down
+    change_column :instances, :condor_job_id, :string
+  end
+end
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index ee9cbaf..36c2839 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -42,6 +42,13 @@ describe Instance do
 
   end
 
+  it "should have a condor_job_id of reasonable length" do
+    @instance.condor_job_id = 'x'*2049
+    @instance.should_not be_valid
+    @instance.condor_job_id = 'x'*2048
+    @instance.should be_valid
+  end
+
   it "should have unique name" do
     @instance.save!
     second_instance = Factory.build(:instance,
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to