deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lalancette <clala...@redhat.com>
Subject [PATCH 07/10] Throw a useful error from GoGrid when the name is too long.
Date Thu, 05 Aug 2010 19:57:21 GMT
Signed-off-by: Chris Lalancette <clalance@redhat.com>
---
 .../lib/deltacloud/drivers/gogrid/gogrid_driver.rb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
index e204cbe..0135123 100644
--- a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+++ b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
@@ -107,6 +107,9 @@ class GogridDriver < Deltacloud::BaseDriver
 
     client = new_client(credentials)
     name = (opts[:name] && opts[:name]!='') ? opts[:name] : get_random_instance_name
+    if name.length > 20
+      raise Deltacloud::BackendError.new(400, "name-too-long", "Name '#{name}' is too long;
the maximum for GoGrid is 20 characters", nil)
+    end
     safely do
       instance = client.request('grid/server/add', {
         'name' => name,
-- 
1.7.2


Mime
View raw message